Skip to content

Commit ccfa47e

Browse files
LiBaokun96gregkh
authored andcommitted
ext4: preserve SB_I_VERSION on remount
commit f2326fd upstream. IMA testing revealed that after an ext4 remount, file accesses triggered full measurements even without modifications, instead of skipping as expected when i_version is unchanged. Debugging showed `SB_I_VERSION` was cleared in reconfigure_super() during remount due to commit 1ff2030 ("ext4: unconditionally enable the i_version counter") removing the fix from commit 960e0ab ("ext4: fix i_version handling on remount"). To rectify this, `SB_I_VERSION` is always set for `fc->sb_flags` in ext4_init_fs_context(), instead of `sb->s_flags` in __ext4_fill_super(), ensuring it persists across all mounts. Cc: stable@kernel.org Fixes: 1ff2030 ("ext4: unconditionally enable the i_version counter") Signed-off-by: Baokun Li <libaokun1@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20250703073903.6952-2-libaokun@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 918974a commit ccfa47e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/ext4/super.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,6 +1998,9 @@ int ext4_init_fs_context(struct fs_context *fc)
19981998
fc->fs_private = ctx;
19991999
fc->ops = &ext4_context_ops;
20002000

2001+
/* i_version is always enabled now */
2002+
fc->sb_flags |= SB_I_VERSION;
2003+
20012004
return 0;
20022005
}
20032006

@@ -5314,9 +5317,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
53145317
sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
53155318
(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
53165319

5317-
/* i_version is always enabled now */
5318-
sb->s_flags |= SB_I_VERSION;
5319-
53205320
/* HSM events are allowed by default. */
53215321
sb->s_iflags |= SB_I_ALLOW_HSM;
53225322

0 commit comments

Comments
 (0)