From: Chuck Lever <[email protected]>

NFS and other remote filesystem protocols need to determine
whether a local filesystem performs case-insensitive lookups
so they can provide correct semantics to clients. Without
this information, f2fs exports cannot properly advertise
their filename case behavior.

Report f2fs case sensitivity behavior via the file_kattr
boolean fields. Like ext4, f2fs supports per-directory case
folding via the casefold flag (IS_CASEFOLDED). Files are
always case-preserving.

Signed-off-by: Chuck Lever <[email protected]>
---
 fs/f2fs/file.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index d7047ca6b98d..e73e6d21d36b 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3439,6 +3439,14 @@ int f2fs_fileattr_get(struct dentry *dentry, struct 
file_kattr *fa)
        if (f2fs_sb_has_project_quota(F2FS_I_SB(inode)))
                fa->fsx_projid = from_kprojid(&init_user_ns, fi->i_projid);
 
+       /*
+        * f2fs always preserves case. If this inode is a casefolded
+        * directory, report case-insensitive; otherwise report
+        * case-sensitive (standard POSIX behavior).
+        */
+       fa->case_insensitive = IS_CASEFOLDED(inode);
+       fa->case_preserving = true;
+
        return 0;
 }
 
-- 
2.52.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to