All of lore.kernel.org
 help / color / mirror / Atom feed
* detecting case-insensitivity
@ 2012-04-07 14:00 J. Bruce Fields
  2012-04-08 23:02 ` Dave Chinner
  2012-04-11 20:03 ` Christoph Hellwig
  0 siblings, 2 replies; 12+ messages in thread
From: J. Bruce Fields @ 2012-04-07 14:00 UTC (permalink / raw)
  To: xfs

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?)

(Somebody recently pointed out to me that NFSv4 has a "case_insensitive"
attribute, which we aren't currently returning a sensible value for.)

--b.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-07 14:00 detecting case-insensitivity J. Bruce Fields
@ 2012-04-08 23:02 ` Dave Chinner
  2012-04-11 20:03 ` Christoph Hellwig
  1 sibling, 0 replies; 12+ messages in thread
From: Dave Chinner @ 2012-04-08 23:02 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: xfs

On Sat, Apr 07, 2012 at 10:00:29AM -0400, J. Bruce Fields wrote:
> 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....

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-07 14:00 detecting case-insensitivity J. Bruce Fields
  2012-04-08 23:02 ` Dave Chinner
@ 2012-04-11 20:03 ` Christoph Hellwig
  2012-04-11 20:37   ` J. Bruce Fields
  1 sibling, 1 reply; 12+ messages in thread
From: Christoph Hellwig @ 2012-04-11 20:03 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: xfs

Can you add a new s_feature_flags instead of s_flags which is shared
with the mount user ABI?  MS_I_VERSION should also move there.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-11 20:03 ` Christoph Hellwig
@ 2012-04-11 20:37   ` J. Bruce Fields
  2012-04-30 21:26     ` J. Bruce Fields
  0 siblings, 1 reply; 12+ messages in thread
From: J. Bruce Fields @ 2012-04-11 20:37 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, Apr 11, 2012 at 04:03:35PM -0400, Christoph Hellwig wrote:
> Can you add a new s_feature_flags instead of s_flags which is shared
> with the mount user ABI?  MS_I_VERSION should also move there.

I was wondering about that.  Yes, that makes a lot more sense, I'll work
on it.

--b.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-11 20:37   ` J. Bruce Fields
@ 2012-04-30 21:26     ` J. Bruce Fields
  2012-04-30 23:01       ` Dave Chinner
  0 siblings, 1 reply; 12+ messages in thread
From: J. Bruce Fields @ 2012-04-30 21:26 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

On Wed, Apr 11, 2012 at 04:37:35PM -0400, J. Bruce Fields wrote:
> On Wed, Apr 11, 2012 at 04:03:35PM -0400, Christoph Hellwig wrote:
> > Can you add a new s_feature_flags instead of s_flags which is shared
> > with the mount user ABI?  MS_I_VERSION should also move there.
> 
> I was wondering about that.  Yes, that makes a lot more sense, I'll work
> on it.

Just something like this?

--b.

>From a77af075724487a62f344cf4dccf4ce1b8324c48 Mon Sep 17 00:00:00 2001
From: "J. Bruce Fields" <bfields@redhat.com>
Date: Mon, 30 Apr 2012 16:43:57 -0400
Subject: [PATCH 1/2] vfs: move MS_I_VERSION to new s_feature_flags field

This is a property of the file system rather than a mount flag (even if
it happens that ext4 uses a mount option to turn i_version updating on
and off.)

We expect there to be other such flags.

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/ext4/super.c    |    4 ++--
 include/linux/fs.h |   12 ++++++++----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 6da1935..003648d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1483,7 +1483,7 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token,
 		sbi->s_mount_flags |= EXT4_MF_FS_ABORTED;
 		return 1;
 	case Opt_i_version:
-		sb->s_flags |= MS_I_VERSION;
+		sb->s_feature_flags |= SF_I_VERSION;
 		return 1;
 	case Opt_journal_dev:
 		if (is_remount) {
@@ -1749,7 +1749,7 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb,
 		SEQ_OPTS_PRINT("min_batch_time=%u", sbi->s_min_batch_time);
 	if (nodefs || sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME)
 		SEQ_OPTS_PRINT("max_batch_time=%u", sbi->s_max_batch_time);
-	if (sb->s_flags & MS_I_VERSION)
+	if (sb->s_flags & SF_I_VERSION)
 		SEQ_OPTS_PUTS("i_version");
 	if (nodefs || sbi->s_stripe)
 		SEQ_OPTS_PRINT("stripe=%lu", sbi->s_stripe);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 99cbb1f..1b0eef8 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -212,7 +212,7 @@ struct inodes_stat_t {
 #define MS_SHARED	(1<<20)	/* change to shared */
 #define MS_RELATIME	(1<<21)	/* Update atime relative to mtime/ctime. */
 #define MS_KERNMOUNT	(1<<22) /* this is a kern_mount call */
-#define MS_I_VERSION	(1<<23) /* Update inode I_version field */
+/* Free bit */
 #define MS_STRICTATIME	(1<<24) /* Always perform atime updates */
 #define MS_NOSEC	(1<<28)
 #define MS_BORN		(1<<29)
@@ -222,7 +222,7 @@ struct inodes_stat_t {
 /*
  * Superblock flags that can be altered by MS_REMOUNT
  */
-#define MS_RMT_MASK	(MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION)
+#define MS_RMT_MASK	(MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK)
 
 /*
  * Old magic mount flag and mask
@@ -230,6 +230,9 @@ struct inodes_stat_t {
 #define MS_MGC_VAL 0xC0ED0000
 #define MS_MGC_MSK 0xffff0000
 
+/* Superblock feature flags: */
+#define SF_I_VERSION	(1<<0)	/* Update inode i_version field */
+
 /* Inode flags - they have nothing to superblock flags now */
 
 #define S_SYNC		1	/* Writes are synced at once */
@@ -268,7 +271,7 @@ struct inodes_stat_t {
 					((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
 #define IS_MANDLOCK(inode)	__IS_FLG(inode, MS_MANDLOCK)
 #define IS_NOATIME(inode)   __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
-#define IS_I_VERSION(inode)   __IS_FLG(inode, MS_I_VERSION)
+#define IS_I_VERSION(inode)  ((inode)->i_sb->s_flags & SF_I_VERSION)
 
 #define IS_NOQUOTA(inode)	((inode)->i_flags & S_NOQUOTA)
 #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND)
@@ -1428,7 +1431,8 @@ 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		s_flags; /* mount flags */
+	unsigned int		s_feature_flags;
 	unsigned long		s_magic;
 	struct dentry		*s_root;
 	struct rw_semaphore	s_umount;
-- 
1.7.7.6


>From 52e25728d2df7608a553dc0713544927adeb3be2 Mon Sep 17 00:00:00 2001
From: "J. Bruce Fields" <bfields@redhat.com>
Date: Mon, 30 Apr 2012 16:58:31 -0400
Subject: [PATCH 2/2] nfsd4: let nfsv4 clients know when an xfs fs is
 case-insensitive

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@infradead.org>
Signed-off-by: J. Bruce Fields <bfields@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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-30 21:26     ` J. Bruce Fields
@ 2012-04-30 23:01       ` Dave Chinner
  2012-05-03 20:22         ` J. Bruce Fields
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Chinner @ 2012-04-30 23:01 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Christoph Hellwig, xfs

On Mon, Apr 30, 2012 at 05:26:49PM -0400, J. Bruce Fields wrote:
> On Wed, Apr 11, 2012 at 04:37:35PM -0400, J. Bruce Fields wrote:
> > On Wed, Apr 11, 2012 at 04:03:35PM -0400, Christoph Hellwig wrote:
> > > Can you add a new s_feature_flags instead of s_flags which is shared
> > > with the mount user ABI?  MS_I_VERSION should also move there.
> > 
> > I was wondering about that.  Yes, that makes a lot more sense, I'll work
> > on it.
> 
> Just something like this?

.....

>  #define S_SYNC		1	/* Writes are synced at once */
> @@ -268,7 +271,7 @@ struct inodes_stat_t {
>  					((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
>  #define IS_MANDLOCK(inode)	__IS_FLG(inode, MS_MANDLOCK)
>  #define IS_NOATIME(inode)   __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
> -#define IS_I_VERSION(inode)   __IS_FLG(inode, MS_I_VERSION)
> +#define IS_I_VERSION(inode)  ((inode)->i_sb->s_flags & SF_I_VERSION)

(inode)->i_sb->s_feature_flags?

>  #define IS_NOQUOTA(inode)	((inode)->i_flags & S_NOQUOTA)
>  #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND)
> @@ -1428,7 +1431,8 @@ 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		s_flags; /* mount flags */
> +	unsigned int		s_feature_flags;

why not an unsigned long like s_flags?

Cheers,

Dave.

-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-30 23:01       ` Dave Chinner
@ 2012-05-03 20:22         ` J. Bruce Fields
  0 siblings, 0 replies; 12+ messages in thread
From: J. Bruce Fields @ 2012-05-03 20:22 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Christoph Hellwig, xfs

On Tue, May 01, 2012 at 09:01:05AM +1000, Dave Chinner wrote:
> On Mon, Apr 30, 2012 at 05:26:49PM -0400, J. Bruce Fields wrote:
> > On Wed, Apr 11, 2012 at 04:37:35PM -0400, J. Bruce Fields wrote:
> > > On Wed, Apr 11, 2012 at 04:03:35PM -0400, Christoph Hellwig wrote:
> > > > Can you add a new s_feature_flags instead of s_flags which is shared
> > > > with the mount user ABI?  MS_I_VERSION should also move there.
> > > 
> > > I was wondering about that.  Yes, that makes a lot more sense, I'll work
> > > on it.
> > 
> > Just something like this?
> 
> .....
> 
> >  #define S_SYNC		1	/* Writes are synced at once */
> > @@ -268,7 +271,7 @@ struct inodes_stat_t {
> >  					((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
> >  #define IS_MANDLOCK(inode)	__IS_FLG(inode, MS_MANDLOCK)
> >  #define IS_NOATIME(inode)   __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
> > -#define IS_I_VERSION(inode)   __IS_FLG(inode, MS_I_VERSION)
> > +#define IS_I_VERSION(inode)  ((inode)->i_sb->s_flags & SF_I_VERSION)
> 
> (inode)->i_sb->s_feature_flags?

Whoops, thanks.

> >  #define IS_NOQUOTA(inode)	((inode)->i_flags & S_NOQUOTA)
> >  #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND)
> > @@ -1428,7 +1431,8 @@ 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		s_flags; /* mount flags */
> > +	unsigned int		s_feature_flags;
> 
> why not an unsigned long like s_flags?

OK.

(Why does it matter?  I figured we can always extend it later.)

--b.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-09 22:27     ` J. Bruce Fields
@ 2012-04-09 22:44       ` Dave Chinner
  0 siblings, 0 replies; 12+ messages in thread
From: Dave Chinner @ 2012-04-09 22:44 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Vyacheslav Dubeyko, xfs

On Mon, Apr 09, 2012 at 06:27:20PM -0400, J. Bruce Fields wrote:
> On Tue, Apr 10, 2012 at 08:19:46AM +1000, Dave Chinner wrote:
> > On Mon, Apr 09, 2012 at 05:28:33PM -0400, J. Bruce Fields wrote:
> > > > > From: Dave Chinner <david@fromorbit.com>
> > > > > Date: 09.04.2012 03.30
> > > > > 
> > > > > On Sat, Apr 07, 2012 at 10:00:29AM -0400, J. Bruce Fields wrote:
> > > > > > 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?
> > 
> > Looks mostly OK to me.
> > 
> > > On Mon, Apr 09, 2012 at 09:01:11AM +0400, Vyacheslav Dubeyko wrote:
> > > > 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)
> 
> 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.

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.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-09 22:19   ` Dave Chinner
@ 2012-04-09 22:27     ` J. Bruce Fields
  2012-04-09 22:44       ` Dave Chinner
  0 siblings, 1 reply; 12+ messages in thread
From: J. Bruce Fields @ 2012-04-09 22:27 UTC (permalink / raw)
  To: Dave Chinner; +Cc: Vyacheslav Dubeyko, xfs

On Tue, Apr 10, 2012 at 08:19:46AM +1000, Dave Chinner wrote:
> On Mon, Apr 09, 2012 at 05:28:33PM -0400, J. Bruce Fields wrote:
> > > > From: Dave Chinner <david@fromorbit.com>
> > > > Date: 09.04.2012 03.30
> > > > 
> > > > On Sat, Apr 07, 2012 at 10:00:29AM -0400, J. Bruce Fields wrote:
> > > > > 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?
> 
> Looks mostly OK to me.
> 
> > On Mon, Apr 09, 2012 at 09:01:11AM +0400, Vyacheslav Dubeyko wrote:
> > > 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)

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.

> 
> ....
> 
> > diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> > index 7423d71..890f439 100644
> > --- a/fs/nfsd/vfs.c
> > +++ b/fs/nfsd/vfs.c
> > @@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-09 21:28 ` J. Bruce Fields
@ 2012-04-09 22:19   ` Dave Chinner
  2012-04-09 22:27     ` J. Bruce Fields
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Chinner @ 2012-04-09 22:19 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: Vyacheslav Dubeyko, xfs

On Mon, Apr 09, 2012 at 05:28:33PM -0400, J. Bruce Fields wrote:
> > > From: Dave Chinner <david@fromorbit.com>
> > > Date: 09.04.2012 03.30
> > > 
> > > On Sat, Apr 07, 2012 at 10:00:29AM -0400, J. Bruce Fields wrote:
> > > > 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?

Looks mostly OK to me.

> On Mon, Apr 09, 2012 at 09:01:11AM +0400, Vyacheslav Dubeyko wrote:
> > 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)

....

> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index 7423d71..890f439 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -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.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
  2012-04-09  5:01 Vyacheslav Dubeyko
@ 2012-04-09 21:28 ` J. Bruce Fields
  2012-04-09 22:19   ` Dave Chinner
  0 siblings, 1 reply; 12+ messages in thread
From: J. Bruce Fields @ 2012-04-09 21:28 UTC (permalink / raw)
  To: Vyacheslav Dubeyko; +Cc: xfs

> > From: Dave Chinner <david@fromorbit.com>
> > Date: 09.04.2012 03.30
> > 
> > On Sat, Apr 07, 2012 at 10:00:29AM -0400, J. Bruce Fields wrote:
> > > 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?

On Mon, Apr 09, 2012 at 09:01:11AM +0400, Vyacheslav Dubeyko wrote:
> 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.

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index bcd8904..53f3044 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_FLG(dentry->d_inode, MS_CASE_INSENSITIVE) ? 1 : 0);
 	}
 	if (bmval0 & FATTR4_WORD0_CASE_PRESERVING) {
 		if ((buflen -= 4) < 0)
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 7423d71..890f439 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -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
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index ee5b695..6367817 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -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)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8975a56..0ee6614 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: detecting case-insensitivity
@ 2012-04-09  5:01 Vyacheslav Dubeyko
  2012-04-09 21:28 ` J. Bruce Fields
  0 siblings, 1 reply; 12+ messages in thread
From: Vyacheslav Dubeyko @ 2012-04-09  5:01 UTC (permalink / raw)
  To: Dave Chinner; +Cc: J. Bruce Fields, xfs


Initial message
> Subject: Re: detecting case-insensitivity
> From: Dave Chinner <david@fromorbit.com>
> Date: 09.04.2012 03.30
> 
> On Sat, Apr 07, 2012 at 10:00:29AM -0400, J. Bruce Fields wrote:
> > 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....
> 
> Cheers,
> 
> Dave.
> -- 
> Dave Chinner
> david@fromorbit.com
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> 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.
slava@dubeyko.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-05-03 20:22 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-07 14:00 detecting case-insensitivity J. Bruce Fields
2012-04-08 23:02 ` Dave Chinner
2012-04-11 20:03 ` Christoph Hellwig
2012-04-11 20:37   ` J. Bruce Fields
2012-04-30 21:26     ` J. Bruce Fields
2012-04-30 23:01       ` Dave Chinner
2012-05-03 20:22         ` J. Bruce Fields
2012-04-09  5:01 Vyacheslav Dubeyko
2012-04-09 21:28 ` J. Bruce Fields
2012-04-09 22:19   ` Dave Chinner
2012-04-09 22:27     ` J. Bruce Fields
2012-04-09 22:44       ` Dave Chinner

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.