[PATCH 2/2] nfsd4: let nfsv4 clients know when an xfs fs is case-insensitive

J. Bruce Fields bfields at redhat.com
Mon Apr 30 15:58:31 CDT 2012


OK, really I suppose this could be two patches, one for xfs, one for
nfsd.

The value currently returned by nfsd is really stupid: if we were going
to return a constant value, "case sensitive" would be a better bet!  Or
we could just choose not to support this attribute at all.

Note xfs's support isn't exactly what the NFSv4 spec would like, as it
doesn't handle utf-8.  Oh well.

Cc: Christoph Hellwig <hch at infradead.org>
Signed-off-by: J. Bruce Fields <bfields at redhat.com>
---
 fs/nfsd/nfs4xdr.c  |    2 +-
 fs/xfs/xfs_super.c |    2 ++
 include/linux/fs.h |    5 ++++-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 40b1cd4..3ed87b0 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2233,7 +2233,7 @@ out_acl:
 	if (bmval0 & FATTR4_WORD0_CASE_INSENSITIVE) {
 		if ((buflen -= 4) < 0)
 			goto out_resource;
-		WRITE32(1);
+		WRITE32(IS_CASE_INSENSITIVE(dentry->d_inode) ? 1 : 0);
 	}
 	if (bmval0 & FATTR4_WORD0_CASE_PRESERVING) {
 		if ((buflen -= 4) < 0)
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index dab9a5f..69dafab 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1361,6 +1361,8 @@ xfs_fs_fill_super(
 	sb->s_max_links = XFS_MAXLINK;
 	sb->s_time_gran = 1;
 	set_posix_acl_flag(sb);
+	if (xfs_sb_version_hasasciici(&mp->m_sb))
+		sb->s_feature_flags |= SF_CASE_INSENSITIVE;
 
 	error = xfs_mountfs(mp);
 	if (error)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 1b0eef8..61d49ad 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -231,7 +231,8 @@ struct inodes_stat_t {
 #define MS_MGC_MSK 0xffff0000
 
 /* Superblock feature flags: */
-#define SF_I_VERSION	(1<<0)	/* Update inode i_version field */
+#define SF_I_VERSION		(1<< 0)	/* Update inode i_version field */
+#define SF_CASE_INSENSITIVE	(1<< 1)
 
 /* Inode flags - they have nothing to superblock flags now */
 
@@ -286,6 +287,8 @@ struct inodes_stat_t {
 #define IS_AUTOMOUNT(inode)	((inode)->i_flags & S_AUTOMOUNT)
 #define IS_NOSEC(inode)		((inode)->i_flags & S_NOSEC)
 
+#define IS_CASE_INSENSITIVE(inode) ((inode)->i_sb->s_feature_flags & SF_CASE_INSENSITIVE)
+
 /* the read-only stuff doesn't really belong here, but any other place is
    probably as bad and I don't want to create yet another include file. */
 
-- 
1.7.7.6



More information about the xfs mailing list