[PATCH] shmem: Report casefold setting in mount options

From: Gabriel Krisman Bertazi

Date: Sun Sep 27 2026 - 02:49:26 EST


For not device-backed filesystems, casefolding is a mount option.
Report the current encoding and casefolding flags in /proc/mounts so
userspace can easily check if casefolding is supported.

Reported-by: Daniel Tang <danielzgtg.opensource@xxxxxxxxx>
Link: https://lore.kernel.org/linux-fsdevel/5193732.31r3eYUQgx@daniel-desktop3/#R
Signed-off-by: Gabriel Krisman Bertazi <krisman@xxxxxxx>
---
mm/shmem.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/mm/shmem.c b/mm/shmem.c
index 897fa2b61346..2b93fcbf5127 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -4916,6 +4916,17 @@ static int shmem_show_options(struct seq_file *seq, struct dentry *root)
if (sbinfo->qlimits.grpquota_ihardlimit)
seq_printf(seq, ",grpquota_inode_hardlimit=%lld",
sbinfo->qlimits.grpquota_ihardlimit);
+#endif
+#if IS_ENABLED(CONFIG_UNICODE)
+ if (root->d_sb->s_encoding) {
+ unsigned int version = root->d_sb->s_encoding->version;
+
+ seq_printf(seq, ",casefold=utf8-%u.%u.%u",
+ unicode_major(version), unicode_minor(version),
+ unicode_rev(version));
+ if (sb_has_strict_encoding(root->d_sb))
+ seq_puts(seq, ",strict_encoding");
+ }
#endif
return 0;
}
--
2.55.0


--=-=-=--