Re: Should exportfs/mountd cope with case-insensitive directory names.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux