From patchwork Wed Mar 25 12:28:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1261346 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=Yau3b5kU; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48nS8S5yCWz9sR4 for ; Wed, 25 Mar 2020 23:28:40 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727544AbgCYM2f (ORCPT ); Wed, 25 Mar 2020 08:28:35 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54220 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727537AbgCYM2c (ORCPT ); Wed, 25 Mar 2020 08:28:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=odzXVZYmd7lUAGEV7AWVw3TgYy4WB3IJY3Y6KA2lMSU=; b=Yau3b5kUjjBG9f4qwQn0pzufd1 5Zqvc3ruUYCUg8fOAmMK1lAqY2FE/xezNNbjcgBdf+Q4WK1z7s09av07BATn0HCqwWzvJ926BtomF 80x9nayMW2gMMEjFA5l/P3/rolns3pyvUCNhm4A0qCNkKdZNTZC442m13HrvOW+Jj+tCoSb2MMNPP mGc2f7OkhQyID4UzfAqqpl1UsJ7NdSe4B3GR16ej9d9bUu/Vvy0Scl6Htq6owDnm5Qne5FaOwbuB/ btD5fblL0m9GlHCnv/EJWTtSUUaTMZnuhLEiFglECgdgUGHb7AqrK6b89uFK5i6p98VkKp29roHyd JqoCkGog==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jH593-0003GS-NL; Wed, 25 Mar 2020 12:28:30 +0000 From: Christoph Hellwig To: "Theodore Ts'o" , Jaegeuk Kim , Chao Yu , Al Viro , Richard Weinberger , linux-xfs@vger.kernel.org Cc: Eric Biggers , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/4] ubifs: remove broken lazytime support Date: Wed, 25 Mar 2020 13:28:22 +0100 Message-Id: <20200325122825.1086872-2-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200325122825.1086872-1-hch@lst.de> References: <20200325122825.1086872-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org When "ubifs: introduce UBIFS_ATIME_SUPPORT to ubifs" introduces atime support to ubifs, it also lazytime support, but that support is terminally broken, as it causes mark_inode_dirty_sync to be called from __writeback_single_inode, which will then trigger the locking assert in ubifs_dirty_inode. Just remove this broken support for now, it can be readded later, especially as some infrastructure changes should make that easier soon. Fixes: 8c1c5f263833 ("ubifs: introduce UBIFS_ATIME_SUPPORT to ubifs") Signed-off-by: Christoph Hellwig --- fs/ubifs/file.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 743928efffc1..49fe062ce45e 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1375,7 +1375,6 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time, struct ubifs_info *c = inode->i_sb->s_fs_info; struct ubifs_budget_req req = { .dirtied_ino = 1, .dirtied_ino_d = ALIGN(ui->data_len, 8) }; - int iflags = I_DIRTY_TIME; int err, release; if (!IS_ENABLED(CONFIG_UBIFS_ATIME_SUPPORT)) @@ -1393,11 +1392,8 @@ int ubifs_update_time(struct inode *inode, struct timespec64 *time, if (flags & S_MTIME) inode->i_mtime = *time; - if (!(inode->i_sb->s_flags & SB_LAZYTIME)) - iflags |= I_DIRTY_SYNC; - release = ui->dirty; - __mark_inode_dirty(inode, iflags); + __mark_inode_dirty(inode, I_DIRTY_SYNC); mutex_unlock(&ui->ui_mutex); if (release) ubifs_release_budget(c, &req); From patchwork Wed Mar 25 12:28:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1261347 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=Nvp1Hr65; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48nS8T45V4z9sSG for ; Wed, 25 Mar 2020 23:28:41 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727570AbgCYM2j (ORCPT ); Wed, 25 Mar 2020 08:28:39 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54680 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727537AbgCYM2h (ORCPT ); Wed, 25 Mar 2020 08:28:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=fUMRiqcR3QbpI9KipJLCvjYPl6+nc19Qgf3nmLi9ugA=; b=Nvp1Hr65GnU3cDNOHLB4oGSUId GlmDae0MlPtksI1qgGxRX1hTGTdOBAqnNVAuSAE7Z1X1wOdBXnV2+fnrhwGI/b4+OxEefk3XfD95k Wwq7C5nL4fbcD0+nf2wCOglMtnoKj0/V6slVbO/FLboT/ZZOKRYepQuZiagqyADdCufjNy3QTy7FX Js6zPTKqInxstVTIkClzxVTvapNjEMUxgjV7A2Nvi6RxJnx1Sm2uBXsUwHJEkmRyEcGCp1pK7+QoR DManta9Eei/bneT0cPDGgcV3y0P124YvfjJrPKSdCcEKEdmchJ0bullSD2MhplNzghPMV2Ua+7YoE 1WuQtvkw==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jH596-0003HP-Gi; Wed, 25 Mar 2020 12:28:33 +0000 From: Christoph Hellwig To: "Theodore Ts'o" , Jaegeuk Kim , Chao Yu , Al Viro , Richard Weinberger , linux-xfs@vger.kernel.org Cc: Eric Biggers , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] fs: avoid double-writing the inode on a lazytime expiration Date: Wed, 25 Mar 2020 13:28:23 +0100 Message-Id: <20200325122825.1086872-3-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200325122825.1086872-1-hch@lst.de> References: <20200325122825.1086872-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In the case that an inode has dirty timestamp for longer than the lazytime expiration timeout (or if all such inodes are being flushed out due to a sync or syncfs system call), we need to inform the file system that the inode is dirty so that the inode's timestamps can be copied out to the on-disk data structures. That's because if the file system supports lazytime, it will have ignored the dirty_inode(inode, I_DIRTY_TIME) notification when the timestamp was modified in memory.q Previously, this was accomplished by calling mark_inode_dirty_sync(), but that has the unfortunate side effect of also putting the inode the writeback list, and that's not necessary in this case, since we will immediately call write_inode() afterwards. Replace the call to mark_inode_dirty_sync() with a new lazytime_expired method to clearly separate out this case. Eric Biggers noticed that this was causing problems for fscrypt after the key was removed[1]. Based on a patch from Theodore Ts'o. [1] https://lore.kernel.org/r/20200306004555.GB225345@gmail.com Fixes: 0ae45f63d4ef ("vfs: add support for a lazytime mount option") Reported-by: Eric Biggers Signed-off-by: Christoph Hellwig --- fs/ext4/super.c | 6 ++++++ fs/f2fs/super.c | 6 ++++++ fs/fs-writeback.c | 3 ++- fs/inode.c | 3 ++- fs/xfs/xfs_super.c | 12 +++--------- include/linux/fs.h | 1 + 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 0c7c4adb664e..ebbf6370ccd6 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1448,6 +1448,11 @@ static struct dquot **ext4_get_dquots(struct inode *inode) return EXT4_I(inode)->i_dquot; } +static void ext4_lazytime_expired(struct inode *inode) +{ + return ext4_dirty_inode(inode, I_DIRTY_SYNC); +} + static const struct dquot_operations ext4_quota_operations = { .get_reserved_space = ext4_get_reserved_space, .write_dquot = ext4_write_dquot, @@ -1480,6 +1485,7 @@ static const struct super_operations ext4_sops = { .destroy_inode = ext4_destroy_inode, .write_inode = ext4_write_inode, .dirty_inode = ext4_dirty_inode, + .lazytime_expired = ext4_lazytime_expired, .drop_inode = ext4_drop_inode, .evict_inode = ext4_evict_inode, .put_super = ext4_put_super, diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 65a7a432dfee..529334573944 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1100,6 +1100,11 @@ static void f2fs_dirty_inode(struct inode *inode, int flags) f2fs_inode_dirtied(inode, false); } +static void f2fs_lazytime_expired(struct inode *inode) +{ + return f2fs_dirty_inode(inode, I_DIRTY_SYNC); +} + static void f2fs_free_inode(struct inode *inode) { fscrypt_free_inode(inode); @@ -2355,6 +2360,7 @@ static const struct super_operations f2fs_sops = { .drop_inode = f2fs_drop_inode, .write_inode = f2fs_write_inode, .dirty_inode = f2fs_dirty_inode, + .lazytime_expired = f2fs_lazytime_expired, .show_options = f2fs_show_options, #ifdef CONFIG_QUOTA .quota_read = f2fs_quota_read, diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 76ac9c7d32ec..dc2d65c765ae 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -1505,7 +1505,8 @@ __writeback_single_inode(struct inode *inode, struct writeback_control *wbc) spin_unlock(&inode->i_lock); if (dirty & I_DIRTY_TIME) - mark_inode_dirty_sync(inode); + inode->i_sb->s_op->lazytime_expired(inode); + /* Don't write the inode if only I_DIRTY_PAGES was set */ if (dirty & ~I_DIRTY_PAGES) { int err = write_inode(inode, wbc); diff --git a/fs/inode.c b/fs/inode.c index 93d9252a00ab..96cf26ed4c7b 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1674,7 +1674,8 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags) if (flags & S_MTIME) inode->i_mtime = *time; if ((flags & (S_ATIME | S_CTIME | S_MTIME)) && - !(inode->i_sb->s_flags & SB_LAZYTIME)) + (!inode->i_sb->s_op->lazytime_expired || + !(inode->i_sb->s_flags & SB_LAZYTIME))) dirty = true; if (dirty) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 2094386af8ac..e5aafd40dd0f 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -612,19 +612,13 @@ xfs_fs_destroy_inode( } static void -xfs_fs_dirty_inode( - struct inode *inode, - int flag) +xfs_fs_lazytime_expired( + struct inode *inode) { struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; struct xfs_trans *tp; - if (!(inode->i_sb->s_flags & SB_LAZYTIME)) - return; - if (flag != I_DIRTY_SYNC || !(inode->i_state & I_DIRTY_TIME)) - return; - if (xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp)) return; xfs_ilock(ip, XFS_ILOCK_EXCL); @@ -1053,7 +1047,7 @@ xfs_fs_free_cached_objects( static const struct super_operations xfs_super_operations = { .alloc_inode = xfs_fs_alloc_inode, .destroy_inode = xfs_fs_destroy_inode, - .dirty_inode = xfs_fs_dirty_inode, + .lazytime_expired = xfs_fs_lazytime_expired, .drop_inode = xfs_fs_drop_inode, .put_super = xfs_fs_put_super, .sync_fs = xfs_fs_sync_fs, diff --git a/include/linux/fs.h b/include/linux/fs.h index abedbffe2c9e..07c213cdecf3 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1948,6 +1948,7 @@ struct super_operations { int (*write_inode) (struct inode *, struct writeback_control *wbc); int (*drop_inode) (struct inode *); void (*evict_inode) (struct inode *); + void (*lazytime_expired)(struct inode *inode); void (*put_super) (struct super_block *); int (*sync_fs)(struct super_block *sb, int wait); int (*freeze_super) (struct super_block *); From patchwork Wed Mar 25 12:28:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1261348 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=uus+icWQ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48nS8Z6P6dz9sR4 for ; Wed, 25 Mar 2020 23:28:46 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727587AbgCYM2m (ORCPT ); Wed, 25 Mar 2020 08:28:42 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55098 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727440AbgCYM2m (ORCPT ); Wed, 25 Mar 2020 08:28:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=eHCeht8Jl87loSG9fXCjdqcbTJKVdxCg8ZdFEYMWIr8=; b=uus+icWQcHSgAhoVsInQ++TwUI qDZjpBIzOwTvK1ys0gtNgZMNwLbEpGG+kCXKe1BpCKD/yrrceIcRvozFaFgfDrpFwWvAnN7oiy6zq mCXVDurYXZaCyFTKOpw5bG1a+BmrxjcUBMiu41iw96exliyRhjrSapCoqIleisGdAulAQVi5J+Bf9 VQHrQGHnkRJy9Dci9+GOp2e5v06DmOQjXrFaCrMIXYeL2JoBxk9knaHgcXDB/0skewK8pto97zhig T5p/CqzfS8zKMU5afyd2Rl3n8Tc4iEpyoJsbsrU0HqTdGK2oqdMQXJsckOLHgmrLKFkypME5RXkT9 SenBw6DQ==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jH599-0003Ko-4c; Wed, 25 Mar 2020 12:28:35 +0000 From: Christoph Hellwig To: "Theodore Ts'o" , Jaegeuk Kim , Chao Yu , Al Viro , Richard Weinberger , linux-xfs@vger.kernel.org Cc: Eric Biggers , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] fs: don't call ->dirty_inode for lazytime timestamp updates Date: Wed, 25 Mar 2020 13:28:24 +0100 Message-Id: <20200325122825.1086872-4-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200325122825.1086872-1-hch@lst.de> References: <20200325122825.1086872-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org There is no need to call into ->dirty_inode for lazytime timestamp updates that use the I_DIRTY_TIME flag, as file systems per definition must ignore them. Signed-off-by: Christoph Hellwig --- fs/ext4/inode.c | 8 +------- fs/f2fs/super.c | 3 --- fs/fs-writeback.c | 8 +++----- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index fa0ff78dc033..dbdcf3cc0e64 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -5805,17 +5805,11 @@ void ext4_dirty_inode(struct inode *inode, int flags) { handle_t *handle; - if (flags == I_DIRTY_TIME) - return; handle = ext4_journal_start(inode, EXT4_HT_INODE, 2); if (IS_ERR(handle)) - goto out; - + return; ext4_mark_inode_dirty(handle, inode); - ext4_journal_stop(handle); -out: - return; } int ext4_change_inode_journal_flag(struct inode *inode, int val) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 529334573944..5f3221ade64e 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1091,9 +1091,6 @@ static void f2fs_dirty_inode(struct inode *inode, int flags) inode->i_ino == F2FS_META_INO(sbi)) return; - if (flags == I_DIRTY_TIME) - return; - if (is_inode_flag_set(inode, FI_AUTO_RECOVER)) clear_inode_flag(inode, FI_AUTO_RECOVER); diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index dc2d65c765ae..482781da8be1 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c @@ -2252,16 +2252,14 @@ void __mark_inode_dirty(struct inode *inode, int flags) * Don't do this for I_DIRTY_PAGES - that doesn't actually * dirty the inode itself */ - if (flags & (I_DIRTY_INODE | I_DIRTY_TIME)) { + if (flags & I_DIRTY_INODE) { trace_writeback_dirty_inode_start(inode, flags); - if (sb->s_op->dirty_inode) sb->s_op->dirty_inode(inode, flags); - trace_writeback_dirty_inode(inode, flags); - } - if (flags & I_DIRTY_INODE) + flags &= ~I_DIRTY_TIME; + } dirtytime = flags & I_DIRTY_TIME; /* From patchwork Wed Mar 25 12:28:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 1261350 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ext4-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=bombadil.20170209 header.b=kNWzkfmP; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 48nS8j1Xlhz9sSW for ; Wed, 25 Mar 2020 23:28:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727611AbgCYM2s (ORCPT ); Wed, 25 Mar 2020 08:28:48 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:55496 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727319AbgCYM2q (ORCPT ); Wed, 25 Mar 2020 08:28:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=bOpFqUPJ9bS+4ZDNHjIcr3PqAyINL9efeQnE7Z928sM=; b=kNWzkfmPTk9pYHmfxP86DPRPIq M/Ipv+fQiCkDkwXVpxqu3vzY7CjHK4yUGuRcjtkjXDrmI5QP67iBFuZ7wmzjWBRflzTR4Oc10Y3Tw TxZGNoKsEh6OdYFpqm6hndtv7nBc0nbnSt/wF5ed6xS4syPSNC5uKBNw5gu3GTreDVpUkm2vzqIHs 2+NSFdsEglJWkR3iq/8Z4aBgwd4eOWC15tQTykGwIj32DdexPLlCe17ITG83vlBMg3Y7I0hu0ytef 96sPrnpgCWNGDBo9diiyYhgbp2R0CAcMwkft9oMIFOoTsjaSOofASaFSKdfAc4+7LfRhpUx2citl6 pM8QRVRA==; Received: from [2001:4bb8:18c:2a9e:999c:283e:b14a:9189] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jH59C-0003No-4o; Wed, 25 Mar 2020 12:28:38 +0000 From: Christoph Hellwig To: "Theodore Ts'o" , Jaegeuk Kim , Chao Yu , Al Viro , Richard Weinberger , linux-xfs@vger.kernel.org Cc: Eric Biggers , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] fs: clean up generic_update_time a bit Date: Wed, 25 Mar 2020 13:28:25 +0100 Message-Id: <20200325122825.1086872-5-hch@lst.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200325122825.1086872-1-hch@lst.de> References: <20200325122825.1086872-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org There is no need both the sync and iflag variables - just use dirty as the indicator for which flag to pass to __mark_inode_dirty, as there is no point in passing both flags - __mark_inode_dirty will immediately clear I_DIRTY_TIME if I_DIRTY_SYNC is set. Signed-off-by: Christoph Hellwig --- fs/inode.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index 96cf26ed4c7b..a7d19b1b15ac 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -1662,7 +1662,6 @@ static int relatime_need_update(struct vfsmount *mnt, struct inode *inode, int generic_update_time(struct inode *inode, struct timespec64 *time, int flags) { - int iflags = I_DIRTY_TIME; bool dirty = false; if (flags & S_ATIME) @@ -1678,9 +1677,7 @@ int generic_update_time(struct inode *inode, struct timespec64 *time, int flags) !(inode->i_sb->s_flags & SB_LAZYTIME))) dirty = true; - if (dirty) - iflags |= I_DIRTY_SYNC; - __mark_inode_dirty(inode, iflags); + __mark_inode_dirty(inode, dirty ? I_DIRTY_SYNC : I_DIRTY_TIME); return 0; } EXPORT_SYMBOL(generic_update_time);