]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
exfat: Implement fileattr_get for case sensitivity
authorChuck Lever <chuck.lever@oracle.com>
Thu, 7 May 2026 08:52:57 +0000 (04:52 -0400)
committerChristian Brauner <brauner@kernel.org>
Mon, 11 May 2026 14:50:28 +0000 (16:50 +0200)
Report exFAT's case sensitivity behavior via the FS_XFLAG_CASEFOLD
flag. exFAT compares names through the volume's upcase table; in
practice that table folds case, and case is preserved at rest.

Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Reviewed-by: Roland Mainz <roland.mainz@nrubsig.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Link: https://github.com/exfatprogs/exfatprogs/issues/313
Link: https://patch.msgid.link/20260507-case-sensitivity-v14-4-e62cc8200435@oracle.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/exfat/exfat_fs.h
fs/exfat/file.c
fs/exfat/namei.c

index 89ef5368277f8dd144ac11b2506e171d0a22cfba..aff4dcd4e75a55296d536c19306813a566d6f0bb 100644 (file)
@@ -496,6 +496,8 @@ int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
 int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
                  struct kstat *stat, unsigned int request_mask,
                  unsigned int query_flags);
+struct file_kattr;
+int exfat_fileattr_get(struct dentry *dentry, struct file_kattr *fa);
 int exfat_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
 long exfat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
 long exfat_compat_ioctl(struct file *filp, unsigned int cmd,
index 354bdcfe4abcdffa7a3373067571a9d60031951c..91e5511945d11b12658908dc6287fabd572d1d6a 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/writeback.h>
 #include <linux/filelock.h>
 #include <linux/falloc.h>
+#include <linux/fileattr.h>
 
 #include "exfat_raw.h"
 #include "exfat_fs.h"
@@ -323,6 +324,18 @@ int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
        return 0;
 }
 
+int exfat_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
+{
+       /*
+        * exFAT compares filenames through an upcase table, so lookup
+        * is always case-insensitive. Long names are stored in UTF-16
+        * with case intact; CASENONPRESERVING stays clear.
+        */
+       fa->fsx_xflags |= FS_XFLAG_CASEFOLD;
+       fa->flags |= FS_CASEFOLD_FL;
+       return 0;
+}
+
 int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
                  struct iattr *attr)
 {
@@ -817,6 +830,7 @@ const struct file_operations exfat_file_operations = {
 };
 
 const struct inode_operations exfat_file_inode_operations = {
-       .setattr     = exfat_setattr,
-       .getattr     = exfat_getattr,
+       .setattr        = exfat_setattr,
+       .getattr        = exfat_getattr,
+       .fileattr_get   = exfat_fileattr_get,
 };
index 2c5636634b4a4ebd819e4df45872927f99a65e1e..94002e43db08d4f98455cb447d40d0c1017fb735 100644 (file)
@@ -1311,4 +1311,5 @@ const struct inode_operations exfat_dir_inode_operations = {
        .rename         = exfat_rename,
        .setattr        = exfat_setattr,
        .getattr        = exfat_getattr,
+       .fileattr_get   = exfat_fileattr_get,
 };