Subject: Re: [vserver] util-vserver and _namespaceCleanup bug (and patch)
From: Xavier Montagutelli <xavier.montagutelli@unilim.fr>
Date: Thu, 25 Feb 2010 13:00:24 +0100

On Thursday 25 February 2010 10:44:32 Herbert Poetzl wrote:
> 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?

Kernel : 2.6.32.8-vs2.3.0.36.29.1

(but the problem is not in the kernel code, just in the userspace code. This 
is an issue for Enrico or Hozac ?)

bash version : 3.2.25(1) (from Red Hat 5.3)

util-vserver : 0.30.216-pre2841

I have not tested the last one, but a quick look at the code of 0.30.216-
pre2880 shows no difference for the function _namespaceCleanup.

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