Subject: util-vserver and _namespaceCleanup bug (and patch)
From: Xavier Montagutelli <xavier.montagutelli@unilim.fr>
Date: Wed, 24 Feb 2010 17:39:21 +0100

 Wed, 24 Feb 2010 17:39:21 +0100
Hello,

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

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