Subject: Re: [vserver] util-vserver and _namespaceCleanup bug (and patch)
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Thu, 25 Feb 2010 10:44:32 +0100

On Wed, Feb 24, 2010 at 05:39:21PM +0100, Xavier Montagutelli wrote:
> Hello,

> I encountered a (big) problem because the namespace cleanup
> functionality doesn't work always well.

kernel and util-vserver version?

thanks,
Herbert

> Test case :

> Start a Vserver named "webmail", vdir located under the mount point 
> "/vservers/webmail"

> The start another VServer "web", vdir mounted under "/vservers/web"
> (same beginning ...)

> The first mount point is not umounted in the namespace of the second
> VServer.

> (vnamespace -e <xid_of_web> cat /proc/mounts)

> From what I understand, the problem is located at the _namespaceCleanup 
> function, the test for not umounting a sub-mount is not correct.

> One solution, verify the path with a trailing "/"

> --- util-vserver/vserver.functions.orig 2010-02-24 17:29:29.000000000 +0100
> +++ util-vserver/vserver.functions      2010-02-24 17:34:13.000000000 +0100
> @@ -1378,7 +1378,8 @@
>      while read -r dev path opts; do
>         test -n "$path" || continue
>         for i in "$root" /dev /proc; do
> -           test "${path#$i}" != "$path" && continue 2
> +           path_dir="${path}/"
> +           test "${path_dir#${i}/}" != "${path_dir}" && continue 2
>         done
>         for i in "${list[@]}" /; do
>             test "$path" = "$i" && continue 2
> 
> -- 
> Xavier Montagutelli                      Tel : +33 (0)5 55 45 77 20
> Service Commun Informatique              Fax : +33 (0)5 55 45 75 95
> Universite de Limoges
> 123, avenue Albert Thomas
> 87060 Limoges cedex