All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Boaz Harrosh <openosd@gmail.com>
Cc: NeilBrown <neilb@suse.de>, NFS <linux-nfs@vger.kernel.org>
Subject: Re: Should exportfs/mountd cope with case-insensitive directory names.
Date: Thu, 3 Apr 2014 13:16:25 -0400	[thread overview]
Message-ID: <20140403171625.GA5884@fieldses.org> (raw)
In-Reply-To: <533D8629.10907@gmail.com>

On Thu, Apr 03, 2014 at 07:02:49PM +0300, Boaz Harrosh wrote:
> On 04/03/2014 04:09 PM, J. Bruce Fields wrote:
> > On Thu, Apr 03, 2014 at 04:46:52PM +1100, NeilBrown wrote:
> >> diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> >> index 9a1bb2767ac2..2d91db76b867 100644
> >> --- a/utils/mountd/cache.c
> >> +++ b/utils/mountd/cache.c
> >> @@ -377,6 +377,28 @@ static char *next_mnt(void **v, char *p)
> >>  	return me->mnt_dir;
> >>  }
> >>  
> >> +static int same_path(char *child, char *parent, int len)
> >> +{
> >> +	static char p[PATH_MAX];
> >> +	struct stat sc, sp;
> >> +	if (len <= 0)
> >> +		len = strlen(child);
> >> +	strncpy(p, child, len);
> >> +	p[len] = 0;
> >> +	if (strcmp(p, parent) == 0)
> >> +		return 1;
> >> +
> 
> Addressing Bruce concern, perhaps you would like to
> also  stricmp the names, so to not lstat on all export
> entries.

If we try to guess the filesystem's case rules we'll go mad.

> +	if (stricmp(p, parent) =! 0)
> +		return 0;
> 
> >> +	if (lstat(p, &sc) != 0)
> >> +		return 0;
> >> +	if (lstat(parent, &sp) != 0)
> >> +		return 0;
> >> +	if (sc.st_dev != sp.st_dev)
> >> +		return 0;
> >> +	if (sc.st_ino != sp.st_ino)
> >> +		return 0;
> 
> Hard links on directories any one ? ;-)

In the presence of bind mounts it's definitely possible for two
different paths to reach the same directory.

I don't know if that's actually a problem here....

--b.

  reply	other threads:[~2014-04-03 17:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-03  5:46 Should exportfs/mountd cope with case-insensitive directory names NeilBrown
2014-04-03 13:09 ` J. Bruce Fields
2014-04-03 16:02   ` Boaz Harrosh
2014-04-03 17:16     ` J. Bruce Fields [this message]
2014-04-03 17:24       ` J. Bruce Fields
2014-04-03 21:21         ` NeilBrown
2014-04-03 21:36           ` J. Bruce Fields
2014-04-03 22:13             ` NeilBrown
2014-04-04 14:34               ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140403171625.GA5884@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=openosd@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.