[vserver] util-vserver and _namespaceCleanup bug (and patch)

From: Xavier Montagutelli <xavier.montagutelli_at_unilim.fr>
Date: Wed 24 Feb 2010 - 16:39:21 GMT
Message-Id: <201002241739.21883.xavier.montagutelli@unilim.fr>

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
Received on Wed Feb 24 16:39:40 2010
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 24 Feb 2010 - 16:39:42 GMT by hypermail 2.1.8