Skip to contentSkip to conversation

detecting case-insensitivity

DISCUSSION Vyacheslav Dubeyko 3 participants 5 messages Apr 9, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Initial message

Quoted 8 lines

Subject: Re: detecting case-insensitivity
From: Dave Chinner <[email protected]>
Date: 09.04.2012 03.30

Quoted 2 lines · J. Bruce Fields

Is there a generic way to detect whether a given filesystem is case-insensitive? If not, how should it be done? (A bit in s_flags?)

Quoted 15 lines

I don't think there is a generic flag for it. We could trivially add one, I think, as it is generally a fixed property for the entire filesystem....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

But why does it need to detect that filesystem case-insensitive or not? In what use-case does it need to make such detection?

With the best regards,
Vyacheslav Dubeyko.
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 10 lines
Quoted 10 lines

From: Dave Chinner <[email protected]>
Date: 09.04.2012 03.30

Quoted 2 lines · J. Bruce Fields

Is there a generic way to detect whether a given filesystem is case-insensitive? If not, how should it be done? (A bit in s_flags?)

I don't think there is a generic flag for it. We could trivially add one, I think, as it is generally a fixed property for the entire filesystem....

So, I assume the following is totally wrong, but the basic idea (create a new flag, set it based on xfs_sb_version_hasasciici, check it in nfsd) would work?

Quoted 1 line · Vyacheslav Dubeyko

But why does it need to detect that filesystem case-insensitive or not? In what use-case does it need to make such detection?

To be honest, I have no idea--it's not a mandatory attribute, so I think I'll instead just ceasing to support the attribute and seeing if anyone complains....

--b.

fs/nfsd/nfs4xdr.c +1 -1
index bcd8904..53f3044 100644
@@ -2233,7 +2233,7 @@ out_acl:
 	if (bmval0 & FATTR4_WORD0_CASE_INSENSITIVE) {
 		if ((buflen -= 4) < 0)
 			goto out_resource;
-		WRITE32(1);
+		WRITE32(__IS_FLG(dentry->d_inode, MS_CASE_INSENSITIVE) ? 1 : 0);
 	}
 	if (bmval0 & FATTR4_WORD0_CASE_PRESERVING) {
 		if ((buflen -= 4) < 0)
fs/nfsd/vfs.c +1 -1
index 7423d71..890f439 100644
@@ -1458,7 +1458,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		switch (createmode) {
 		case NFS3_CREATE_UNCHECKED:
 			if (! S_ISREG(dchild->d_inode->i_mode))
-				err = nfserr_exist;
+				goto out;
 			else if (truncp) {
 				/* in nfsv4, we need to treat this case a little
 				 * differently.  we don't want to truncate the
fs/xfs/xfs_super.c +2 -0
index ee5b695..6367817 100644
@@ -1343,6 +1343,8 @@ xfs_fs_fill_super(
 	sb->s_maxbytes = xfs_max_file_offset(sb->s_blocksize_bits);
 	sb->s_time_gran = 1;
 	set_posix_acl_flag(sb);
+	if (xfs_sb_version_hasasciici(&mp->m_sb))
+		sb->s_flags |= MS_CASE_INSENSITIVE;
 
 	error = xfs_mountfs(mp);
 	if (error)
include/linux/fs.h +3 -1
index 8975a56..0ee6614 100644
@@ -218,6 +218,8 @@ struct inodes_stat_t {
 #define MS_BORN		(1<<29)
 #define MS_ACTIVE	(1<<30)
 #define MS_NOUSER	(1<<31)
+#define MS_CASE_INSENSITIVE (1<<32)
+
 
 /*
  * Superblock flags that can be altered by MS_REMOUNT
@@ -1421,7 +1423,7 @@ struct super_block {
 	const struct dquot_operations	*dq_op;
 	const struct quotactl_ops	*s_qcop;
 	const struct export_operations *s_export_op;
-	unsigned long		s_flags;
+	unsigned long long	s_flags;
 	unsigned long		s_magic;
 	struct dentry		*s_root;
 	struct rw_semaphore	s_umount;

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#2 lore raw
Quoted 7 lines · J. Bruce Fields
Quoted 7 lines
Quoted 7 lines

From: Dave Chinner <[email protected]>
Date: 09.04.2012 03.30

Quoted 2 lines · J. Bruce Fields

Is there a generic way to detect whether a given filesystem is case-insensitive? If not, how should it be done? (A bit in s_flags?)

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I don't think there is a generic flag for it. We could trivially add one, I think, as it is generally a fixed property for the entire filesystem....

So, I assume the following is totally wrong, but the basic idea (create a new flag, set it based on xfs_sb_version_hasasciici, check it in nfsd) would work?

Looks mostly OK to me.

Quoted 6 lines · Vyacheslav Dubeyko
Quoted 1 line

But why does it need to detect that filesystem case-insensitive or not? In what use-case does it need to make such detection?

To be honest, I have no idea--it's not a mandatory attribute, so I think I'll instead just ceasing to support the attribute and seeing if anyone complains....

I suspect that there are some applications out there that might care that Bruce and bruce are the same file for matching purposes (e.g. a file manager)

....

fs/nfsd/vfs.c do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, · line 1461

Quoted 10 lines
fs/nfsd/vfs.c +1 -1
index 7423d71..890f439 100644
@@ -1458,7 +1458,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		switch (createmode) {
 		case NFS3_CREATE_UNCHECKED:
 			if (! S_ISREG(dchild->d_inode->i_mode))
-				err = nfserr_exist;
+				goto out;

Not sure what this change is for, though....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#3 lore raw
Quoted 21 lines · Dave Chinner
Quoted 7 lines · J. Bruce Fields
Quoted 7 lines
Quoted 7 lines

From: Dave Chinner <[email protected]>
Date: 09.04.2012 03.30

Quoted 2 lines · J. Bruce Fields

Is there a generic way to detect whether a given filesystem is case-insensitive? If not, how should it be done? (A bit in s_flags?)

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I don't think there is a generic flag for it. We could trivially add one, I think, as it is generally a fixed property for the entire filesystem....

So, I assume the following is totally wrong, but the basic idea (create a new flag, set it based on xfs_sb_version_hasasciici, check it in nfsd) would work?

Looks mostly OK to me.

Quoted 3 lines · Vyacheslav Dubeyko
Quoted 1 line

But why does it need to detect that filesystem case-insensitive or not? In what use-case does it need to make such detection?

Quoted 7 lines
Quoted 3 lines

To be honest, I have no idea--it's not a mandatory attribute, so I think I'll instead just ceasing to support the attribute and seeing if anyone complains....

I suspect that there are some applications out there that might care that Bruce and bruce are the same file for matching purposes (e.g. a file manager)

I suppose they could try the create and find out what happens.

If they actually want to be able to predict collisions instead of recognizing them after the fact then they may need to know in more detail how we handle case, and then I worry that I'll have to start understanding what language like this means:

http://tools.ietf.org/html/draft-ietf-nfsv4-rfc3530bis-17#section-12.7.1.3

...if the NFSv4 file server supports the case_insensitive file system attribute, and if the case_insensitive attribute is true for a given file system, the NFS version 4 server MUST use the Unicode case mapping tables for the version of Unicode corresponding to the character repertoire.

which isn't high on my todo list.

I'll ask around and repost this patch if it looks like somebody actually would find that attribute useful.

Quoted 15 lines

....

fs/nfsd/vfs.c do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp, · line 1461

Quoted 10 lines
fs/nfsd/vfs.c +1 -1
index 7423d71..890f439 100644
@@ -1458,7 +1458,7 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 		switch (createmode) {
 		case NFS3_CREATE_UNCHECKED:
 			if (! S_ISREG(dchild->d_inode->i_mode))
-				err = nfserr_exist;
+				goto out;

Not sure what this change is for, though....

Erp, leaked from another patch.

--b.

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#4 lore raw
Quoted 39 lines · J. Bruce Fields
Quoted 21 lines · Dave Chinner
Quoted 7 lines · J. Bruce Fields
Quoted 7 lines
Quoted 7 lines

From: Dave Chinner <[email protected]>
Date: 09.04.2012 03.30

Quoted 2 lines · J. Bruce Fields

Is there a generic way to detect whether a given filesystem is case-insensitive? If not, how should it be done? (A bit in s_flags?)

Quoted 7 lines
Quoted 3 lines
Quoted 3 lines

I don't think there is a generic flag for it. We could trivially add one, I think, as it is generally a fixed property for the entire filesystem....

So, I assume the following is totally wrong, but the basic idea (create a new flag, set it based on xfs_sb_version_hasasciici, check it in nfsd) would work?

Looks mostly OK to me.

Quoted 3 lines · Vyacheslav Dubeyko
Quoted 1 line

But why does it need to detect that filesystem case-insensitive or not? In what use-case does it need to make such detection?

Quoted 7 lines
Quoted 3 lines

To be honest, I have no idea--it's not a mandatory attribute, so I think I'll instead just ceasing to support the attribute and seeing if anyone complains....

I suspect that there are some applications out there that might care that Bruce and bruce are the same file for matching purposes (e.g. a file manager)

I suppose they could try the create and find out what happens.

If they actually want to be able to predict collisions instead of recognizing them after the fact then they may need to know in more detail how we handle case, and then I worry that I'll have to start understanding what language like this means:

http://tools.ietf.org/html/draft-ietf-nfsv4-rfc3530bis-17#section-12.7.1.3

Quoted 7 lines

...if the NFSv4 file server supports the case_insensitive file system attribute, and if the case_insensitive attribute is true for a given file system, the NFS version 4 server MUST use the Unicode case mapping tables for the version of Unicode corresponding to the character repertoire.

which isn't high on my todo list.

Right, unicode CI is a bitch to handle. There's still a lot of work to be done in XFS before that is supported. See:

http://xfs.org/index.php/Unfinished_work#Support_for_unicode_.2F_utf8_filesystems

So if the NFSv4 flag really means full unicode CI, then there's still work at the XFS level to be able to support that. ASCII CI is a walk in the park compared to unicode....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs