From patchwork Tue Apr 11 09:50:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleksij Rempel X-Patchwork-Id: 9674815 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D57AF60382 for ; Tue, 11 Apr 2017 09:51:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFB0A284BA for ; Tue, 11 Apr 2017 09:51:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A2A512852E; Tue, 11 Apr 2017 09:51:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B0C8284BA for ; Tue, 11 Apr 2017 09:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752224AbdDKJvP (ORCPT ); Tue, 11 Apr 2017 05:51:15 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:59335 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751816AbdDKJvO (ORCPT ); Tue, 11 Apr 2017 05:51:14 -0400 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cxsS2-0002iD-3a; Tue, 11 Apr 2017 11:51:06 +0200 Received: from ore by dude.hi.pengutronix.de with local (Exim 4.88) (envelope-from ) id 1cxsS1-0008UG-3t; Tue, 11 Apr 2017 11:51:05 +0200 From: Oleksij Rempel To: richard@nod.at, dedekind1@gmail.com, adrian.hunter@intel.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Cc: Oleksij Rempel Subject: [PATCH v2 2/3] fs: ubifs: update i_version on inode changes Date: Tue, 11 Apr 2017 11:50:54 +0200 Message-Id: <20170411095055.26328-3-o.rempel@pengutronix.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170411095055.26328-1-o.rempel@pengutronix.de> References: <20170411095055.26328-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-fsdevel@vger.kernel.org Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP increment i_version to notify security/IMA about changes made in inode. Signed-off-by: Oleksij Rempel --- fs/ubifs/file.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index d9ae86f96df7..29213724259b 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1104,6 +1104,8 @@ static void do_attr_changes(struct inode *inode, const struct iattr *attr) mode &= ~S_ISGID; inode->i_mode = mode; } + if (IS_I_VERSION(inode)) + inode_inc_iversion(inode); } /** @@ -1401,6 +1403,9 @@ int ubifs_update_time(struct inode *inode, struct timespec *time, if (!(inode->i_sb->s_flags & MS_LAZYTIME)) iflags |= I_DIRTY_SYNC; + if (IS_I_VERSION(inode)) + inode_inc_iversion(inode); + release = ui->dirty; __mark_inode_dirty(inode, iflags); mutex_unlock(&ui->ui_mutex); @@ -1435,6 +1440,8 @@ static int update_mctime(struct inode *inode) mutex_lock(&ui->ui_mutex); inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); + if (IS_I_VERSION(inode)) + inode_inc_iversion(inode); release = ui->dirty; mark_inode_dirty_sync(inode); mutex_unlock(&ui->ui_mutex); @@ -1580,6 +1587,8 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf) mutex_lock(&ui->ui_mutex); inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); + if (IS_I_VERSION(inode)) + inode_inc_iversion(inode); release = ui->dirty; mark_inode_dirty_sync(inode); mutex_unlock(&ui->ui_mutex);