From: libaokun@huaweicloud.com
To: linux-mm@kvack.org
Cc: hughd@google.com, baolin.wang@linux.alibaba.com,
akpm@linux-foundation.org, jlayton@kernel.org,
linux-kernel@vger.kernel.org, Baokun Li <libaokun1@huawei.com>
Subject: [PATCH] tmpfs: preserve SB_I_VERSION on remount
Date: Tue, 19 Aug 2025 14:18:03 +0800 [thread overview]
Message-ID: <20250819061803.1496443-1-libaokun@huaweicloud.com> (raw)
From: Baokun Li <libaokun1@huawei.com>
Now tmpfs enables i_version by default and tmpfs does not modify it. But
SB_I_VERSION can also be modified via sb_flags, and reconfigure_super()
always overwrites the existing flags with the latest ones. This means that
if tmpfs is remounted without specifying iversion, the default i_version
will be unexpectedly disabled.
To ensure iversion remains enabled, SB_I_VERSION is now always set for
fc->sb_flags in shmem_init_fs_context(), instead of for sb->s_flags in
shmem_fill_super().
Fixes: 36f05cab0a2c ("tmpfs: add support for an i_version counter")
Signed-off-by: Baokun Li <libaokun1@huawei.com>
---
mm/shmem.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index e2c76a30802b..eebe12ff5bc6 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5081,7 +5081,7 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
sb->s_flags |= SB_NOUSER;
}
sb->s_export_op = &shmem_export_ops;
- sb->s_flags |= SB_NOSEC | SB_I_VERSION;
+ sb->s_flags |= SB_NOSEC;
#if IS_ENABLED(CONFIG_UNICODE)
if (!ctx->encoding && ctx->strict_encoding) {
@@ -5385,6 +5385,9 @@ int shmem_init_fs_context(struct fs_context *fc)
fc->fs_private = ctx;
fc->ops = &shmem_fs_context_ops;
+#ifdef CONFIG_TMPFS
+ fc->sb_flags |= SB_I_VERSION;
+#endif
return 0;
}
--
2.39.2
next reply other threads:[~2025-08-19 6:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 6:18 libaokun [this message]
2025-08-19 8:36 ` Baolin Wang
2025-08-19 10:08 ` Jeff Layton
2025-08-22 2:49 ` Hugh Dickins
2025-08-22 4:03 ` Baokun Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250819061803.1496443-1-libaokun@huaweicloud.com \
--to=libaokun@huaweicloud.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=hughd@google.com \
--cc=jlayton@kernel.org \
--cc=libaokun1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox