Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752891AbdDJGyS (ORCPT ); Mon, 10 Apr 2017 02:54:18 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:37141 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbdDJGyF (ORCPT ); Mon, 10 Apr 2017 02:54:05 -0400 From: Oleksij Rempel To: richard@nod.at, dedekind1@gmail.com, adrian.hunter@intel.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Sascha Hauer , Oleksij Rempel Subject: [PATCH v1 2/3] fs: ubifs: i_version on inode changes Date: Mon, 10 Apr 2017 08:53:45 +0200 Message-Id: <20170410065346.1992-2-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170410065346.1992-1-o.rempel@pengutronix.de> References: <20170410065346.1992-1-o.rempel@pengutronix.de> X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::7 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1928 Lines: 61 From: Sascha Hauer This is necessary for IMA/EVM to detect changes on inodes. Signed-off-by: Sascha Hauer Signed-off-by: Oleksij Rempel --- fs/ubifs/dir.c | 8 -------- fs/ubifs/file.c | 2 ++ fs/ubifs/super.c | 3 +-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 30825d882aa9..4a300bfabf9b 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -111,14 +111,6 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, struct inode *dir, if (!inode) return ERR_PTR(-ENOMEM); - /* - * Set 'S_NOCMTIME' to prevent VFS form updating [mc]time of inodes and - * marking them dirty in file write path (see 'file_update_time()'). - * UBIFS has to fully control "clean <-> dirty" transitions of inodes - * to make budgeting work. - */ - inode->i_flags |= S_NOCMTIME; - inode_init_owner(inode, dir, mode); inode->i_mtime = inode->i_atime = inode->i_ctime = ubifs_current_time(inode); diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index d9ae86f96df7..3cbc662ce160 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1391,6 +1391,8 @@ int ubifs_update_time(struct inode *inode, struct timespec *time, return err; mutex_lock(&ui->ui_mutex); + if (flags & S_VERSION) + inode_inc_iversion(inode); if (flags & S_ATIME) inode->i_atime = *time; if (flags & S_CTIME) diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 61180bee38b4..76e44ab88065 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -128,9 +128,8 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum) if (err) goto out_ino; - inode->i_flags |= S_NOCMTIME; #ifndef CONFIG_UBIFS_ATIME_SUPPORT - inode->i_flags |= S_NOATIME; + inode->i_flags |= S_NOATIME | S_NOCMTIME; #endif set_nlink(inode, le32_to_cpu(ino->nlink)); i_uid_write(inode, le32_to_cpu(ino->uid)); -- 2.11.0