From: Gabriel Krisman Bertazi <krisman@suse.de>
To: "Daniel Tang" <danielzgtg.opensource@gmail.com>,
"André Almeida" <andrealmeid@igalia.com>,
"Christian Brauner" <brauner@kernel.org>,
linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Jan Kara <jack@suse.cz>,
Theodore Ts'o <tytso@mit.edu>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jonathan Corbet <corbet@lwn.net>,
smcv@collabora.com, kernel-dev@igalia.com,
linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org,
linux-mm@kvack.org, linux-doc@vger.kernel.org
Subject: Re: [BUG] Is casefold unreported in /proc/mounts?
Date: Sun, 27 Sep 2026 03:02:01 -0400 [thread overview]
Message-ID: <877bk7yy6u.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <5193732.31r3eYUQgx@daniel-desktop3>
[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]
Daniel Tang <danielzgtg.opensource@gmail.com> writes:
> Upon successfully mounting via `sudo mount -t tmpfs -o casefold test /mnt`, I
> cannot find a read-only way to determine whether this option is enabled.
> `mount`, `cat /proc/mounts`, and `cat /proc/mountinfo` only display "rw",
> "relatime", and "inode64", never "casefold" for both with and without
> `-o casefold`. The only way on 7.0.0-34-generic to test I found is
> `mkdir test ; chattr +F test ; echo $?`, but that isn't atomic. Which command
> can determine, without writing anything, whether someone or some program
> specified `-o casefold`? If absent, I suggest adding the missing info to
> `/proc/mounts`, likely `mm/shmem.c:shmem_show_options`.
Yeah. For device-backed filesystems it is not a mount parameter, but it
is for shmem/ovl and should show in /proc/mounts.
Either way, there are two ways to check:
1) Parse dmesg after the mount. It is easily overwritten and probably
worse than just trying;
2) better way: do FS_IOC_SETFLAGS on the mountpoint (with chattr
+F). If casefold is supported, you'll get -ENOTEMPTY, otherwise you get
-EOPNOTSUPP. Since it is the root of the filesystem and a single
syscall, unless its remounted from under you (in which case /proc/mounts
doesn't help either), you are safe.
It is worth mentioning you can check kernel support with
/sys/fs/*/features/casefold. We probably should add the same for
/sys/fs/ext4/<disk>/.
This fixes /proc/mounts for shmem:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-shmem-Report-casefold-setting-in-mount-options.patch --]
[-- Type: text/x-patch, Size: 1414 bytes --]
From c4b198424fac49e10e32553b223b7615febc6513 Mon Sep 17 00:00:00 2001
From: Gabriel Krisman Bertazi <krisman@suse.de>
Date: Sun, 27 Sep 2026 02:49:26 -0400
Subject: [PATCH] shmem: Report casefold setting in mount options
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@gmail.com>
Link: https://lore.kernel.org/linux-fsdevel/5193732.31r3eYUQgx@daniel-desktop3/#R
Signed-off-by: Gabriel Krisman Bertazi <krisman@suse.de>
---
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
next prev parent reply other threads:[~2026-09-27 7:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-21 16:37 [PATCH v8 0/9] tmpfs: Add case-insensitive support for tmpfs André Almeida
2024-10-21 16:37 ` [PATCH v8 1/9] libfs: Create the helper function generic_ci_validate_strict_name() André Almeida
2024-10-21 16:37 ` [PATCH v8 2/9] ext4: Use generic_ci_validate_strict_name helper André Almeida
2024-10-21 16:37 ` [PATCH v8 3/9] unicode: Export latest available UTF-8 version number André Almeida
2024-10-21 16:37 ` [PATCH v8 4/9] unicode: Recreate utf8_parse_version() André Almeida
2024-10-21 16:37 ` [PATCH v8 5/9] libfs: Export generic_ci_ dentry functions André Almeida
2024-10-21 16:37 ` [PATCH v8 6/9] tmpfs: Add casefold lookup support André Almeida
2026-09-27 6:02 ` [BUG] Is casefold unreported in /proc/mounts? Daniel Tang
2026-09-27 7:02 ` Gabriel Krisman Bertazi [this message]
2024-10-21 16:37 ` [PATCH v8 7/9] tmpfs: Add flag FS_CASEFOLD_FL support for tmpfs dirs André Almeida
2024-10-21 16:37 ` [PATCH v8 8/9] tmpfs: Expose filesystem features via sysfs André Almeida
2024-10-31 5:18 ` Nathan Chancellor
2024-10-31 17:31 ` André Almeida
2024-10-31 18:13 ` Nathan Chancellor
2024-10-31 19:11 ` André Almeida
2024-10-21 16:37 ` [PATCH v8 9/9] docs: tmpfs: Add casefold options André Almeida
2024-10-28 12:37 ` [PATCH v8 0/9] tmpfs: Add case-insensitive support for tmpfs Christian Brauner
2024-10-28 13:58 ` André Almeida
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=877bk7yy6u.fsf@mailhost.krisman.be \
--to=krisman@suse.de \
--cc=adilger.kernel@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=andrealmeid@igalia.com \
--cc=brauner@kernel.org \
--cc=corbet@lwn.net \
--cc=danielzgtg.opensource@gmail.com \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=kernel-dev@igalia.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=smcv@collabora.com \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.