Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH 1/2] ext4: show the default enabled i_version option
@ 2025-07-03  7:39 libaokun
  2025-07-03  7:39 ` [PATCH 2/2] ext4: preserve SB_I_VERSION on remount libaokun
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: libaokun @ 2025-07-03  7:39 UTC (permalink / raw)
  To: linux-ext4
  Cc: tytso, adilger.kernel, jack, linux-kernel, yi.zhang, yangerkun,
	libaokun1, libaokun

From: Baokun Li <libaokun1@huawei.com>

Display `i_version` in `/proc/fs/ext4/sdx/options`, even though it's
default enabled. This aids users managing multi-version scenarios and
simplifies debugging.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/ext4/super.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c7d39da7e733..9203518786e4 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2975,6 +2975,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
 		SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
 	if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
 		SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
+	if (nodefs && sb->s_flags & SB_I_VERSION)
+		SEQ_OPTS_PUTS("i_version");
 	if (nodefs || sbi->s_stripe)
 		SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
 	if (nodefs || EXT4_MOUNT_DATA_FLAGS &
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] ext4: preserve SB_I_VERSION on remount
  2025-07-03  7:39 [PATCH 1/2] ext4: show the default enabled i_version option libaokun
@ 2025-07-03  7:39 ` libaokun
  2025-07-03 16:41   ` Jan Kara
  2025-07-03 16:36 ` [PATCH 1/2] ext4: show the default enabled i_version option Jan Kara
  2025-08-14 14:48 ` Theodore Ts'o
  2 siblings, 1 reply; 5+ messages in thread
From: libaokun @ 2025-07-03  7:39 UTC (permalink / raw)
  To: linux-ext4
  Cc: tytso, adilger.kernel, jack, linux-kernel, yi.zhang, yangerkun,
	libaokun1, libaokun

From: Baokun Li <libaokun1@huawei.com>

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 1ff20307393e ("ext4: unconditionally enable the
i_version counter") removing the fix from commit 960e0ab63b2e ("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.

Fixes: 1ff20307393e ("ext4: unconditionally enable the i_version counter")
Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
 fs/ext4/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 9203518786e4..ed1b36bd51c8 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1998,6 +1998,9 @@ int ext4_init_fs_context(struct fs_context *fc)
 	fc->fs_private = ctx;
 	fc->ops = &ext4_context_ops;
 
+	/* i_version is always enabled now */
+	fc->sb_flags |= SB_I_VERSION;
+
 	return 0;
 }
 
@@ -5316,9 +5319,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 	sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
 		(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
 
-	/* i_version is always enabled now */
-	sb->s_flags |= SB_I_VERSION;
-
 	/* HSM events are allowed by default. */
 	sb->s_iflags |= SB_I_ALLOW_HSM;
 
-- 
2.46.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ext4: show the default enabled i_version option
  2025-07-03  7:39 [PATCH 1/2] ext4: show the default enabled i_version option libaokun
  2025-07-03  7:39 ` [PATCH 2/2] ext4: preserve SB_I_VERSION on remount libaokun
@ 2025-07-03 16:36 ` Jan Kara
  2025-08-14 14:48 ` Theodore Ts'o
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2025-07-03 16:36 UTC (permalink / raw)
  To: libaokun
  Cc: linux-ext4, tytso, adilger.kernel, jack, linux-kernel, yi.zhang,
	yangerkun, libaokun1

On Thu 03-07-25 15:39:02, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
> 
> Display `i_version` in `/proc/fs/ext4/sdx/options`, even though it's
> default enabled. This aids users managing multi-version scenarios and
> simplifies debugging.
> 
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

OK, I guess it makes sense as a backward compatibility glue. Feel free to
add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/super.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index c7d39da7e733..9203518786e4 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -2975,6 +2975,8 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
>  		SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
>  	if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
>  		SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
> +	if (nodefs && sb->s_flags & SB_I_VERSION)
> +		SEQ_OPTS_PUTS("i_version");
>  	if (nodefs || sbi->s_stripe)
>  		SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
>  	if (nodefs || EXT4_MOUNT_DATA_FLAGS &
> -- 
> 2.46.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] ext4: preserve SB_I_VERSION on remount
  2025-07-03  7:39 ` [PATCH 2/2] ext4: preserve SB_I_VERSION on remount libaokun
@ 2025-07-03 16:41   ` Jan Kara
  0 siblings, 0 replies; 5+ messages in thread
From: Jan Kara @ 2025-07-03 16:41 UTC (permalink / raw)
  To: libaokun
  Cc: linux-ext4, tytso, adilger.kernel, jack, linux-kernel, yi.zhang,
	yangerkun, libaokun1

On Thu 03-07-25 15:39:03, libaokun@huaweicloud.com wrote:
> From: Baokun Li <libaokun1@huawei.com>
> 
> 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 1ff20307393e ("ext4: unconditionally enable the
> i_version counter") removing the fix from commit 960e0ab63b2e ("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.
> 
> Fixes: 1ff20307393e ("ext4: unconditionally enable the i_version counter")
> Signed-off-by: Baokun Li <libaokun1@huawei.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/super.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 9203518786e4..ed1b36bd51c8 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -1998,6 +1998,9 @@ int ext4_init_fs_context(struct fs_context *fc)
>  	fc->fs_private = ctx;
>  	fc->ops = &ext4_context_ops;
>  
> +	/* i_version is always enabled now */
> +	fc->sb_flags |= SB_I_VERSION;
> +
>  	return 0;
>  }
>  
> @@ -5316,9 +5319,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
>  	sb->s_flags = (sb->s_flags & ~SB_POSIXACL) |
>  		(test_opt(sb, POSIX_ACL) ? SB_POSIXACL : 0);
>  
> -	/* i_version is always enabled now */
> -	sb->s_flags |= SB_I_VERSION;
> -
>  	/* HSM events are allowed by default. */
>  	sb->s_iflags |= SB_I_ALLOW_HSM;
>  
> -- 
> 2.46.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] ext4: show the default enabled i_version option
  2025-07-03  7:39 [PATCH 1/2] ext4: show the default enabled i_version option libaokun
  2025-07-03  7:39 ` [PATCH 2/2] ext4: preserve SB_I_VERSION on remount libaokun
  2025-07-03 16:36 ` [PATCH 1/2] ext4: show the default enabled i_version option Jan Kara
@ 2025-08-14 14:48 ` Theodore Ts'o
  2 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2025-08-14 14:48 UTC (permalink / raw)
  To: Ext4 Developers List, libaokun
  Cc: Theodore Ts'o, adilger.kernel, jack, linux-kernel, yi.zhang,
	yangerkun, libaokun1


On Thu, 03 Jul 2025 15:39:02 +0800, libaokun@huaweicloud.com wrote:
> Display `i_version` in `/proc/fs/ext4/sdx/options`, even though it's
> default enabled. This aids users managing multi-version scenarios and
> simplifies debugging.
> 
> 

Applied, thanks!

[1/2] ext4: show the default enabled i_version option
      commit: 6a912e8aa2b2fba2519e93a2eac197d16f137c9a
[2/2] ext4: preserve SB_I_VERSION on remount
      commit: f2326fd14a224e4cccbab89e14c52279ff79b7ec

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-14 14:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03  7:39 [PATCH 1/2] ext4: show the default enabled i_version option libaokun
2025-07-03  7:39 ` [PATCH 2/2] ext4: preserve SB_I_VERSION on remount libaokun
2025-07-03 16:41   ` Jan Kara
2025-07-03 16:36 ` [PATCH 1/2] ext4: show the default enabled i_version option Jan Kara
2025-08-14 14:48 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox