[PATCH] mount.cifs: fix several problems when mounting subdirectories of shares (try 2)

simo idra at samba.org
Mon Mar 31 20:06:18 GMT 2008


On Mon, 2008-03-10 at 15:54 -0400, Jeff Layton wrote:
> This patch is the second patch to attempt to fix up some of the problems
> with mounting subdirectories of shares. The earlier patch didn't handle
> this correctly when POSIX extensions were enabled. This one does.
> 
> This is a bit of a confusing area since the different components of
> a service string have different rules:
> 
> 1) hostname: no '/' (slash) or '\' (backslash) is allowed to be
> 	     embedded within the string
> 
> 2) sharename: same rules as hostname
> 
> 3) prefixpath: '\' *is* allowed to be embedded in a path component,
> 	       iff POSIX extensions are enabled. Otherwise, neither
> 	       character is allowed.
> 
> The idea here is to allow either character to act as a delimiter when we
> know that the character can't be anything but a delimiter (namely
> everywhere up to the start of the prefixpath). The patch will convert
> any '\' unconditionally to '/' in the UNC portion of the string.
> 
> However, inside the prefixpath, we can't make assumptions about what
> constitutes a delimiter because POSIX allows for embedded '\'
> characters. So there we don't attempt to do any conversion, and pass the
> prefixpath to the kernel as is. Once the kernel determines whether POSIX
> extensions are enabled, it can then convert the path if needed and it's
> able to do so. A patch to handle this has already been committed to the
> cifs-2.6 git tree.
> 
> This patch also fixes an annoyance. When you mount a subdir of a share,
> mount.cifs munges the device string so that you can't tell what the
> prefixpath is. So if I mount:
> 
> 	//server/share/p1/p2/p3
> 
> ..then /proc/mounts and mtab will show only:
> 
> 	//server/share
> 
> Finally, it also tries to apply some consistent rules to the uppercasing
> of strings.
> 
> Signed-off-by: Jeff Layton <jlayton at redhat.com>


Tested and Pushed into v3-2-test.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Senior Software Engineer at Red Hat Inc. <ssorce at redhat.com>



More information about the samba-technical mailing list