Package: util-vserver
Version: 0.30.210-3
Severity: wishlist

Please add namespace cleanup. The attached patch implements it properly
in userspace.

It is only activated on request and only touch filesystems not under the
vserver root and different to /dev and /proc.

Bastian

-- 
Only a fool fights in a burning house.
                -- Kank the Klingon, "Day of the Dove", stardate unknown
diff -u util-vserver-0.30.210/debian/changelog 
util-vserver-0.30.210/debian/changelog
--- util-vserver-0.30.210/debian/changelog
+++ util-vserver-0.30.210/debian/changelog
@@ -1,3 +1,10 @@
+util-vserver (0.30.210-3.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Add proper namespace cleanup. 
+
+ -- Bastian Blank <[EMAIL PROTECTED]>  Wed,  5 Apr 2006 20:09:41 +0200
+
 util-vserver (0.30.210-3) unstable; urgency=low
 
   * Removed bashisms from initscript (Closes: #360675)
only in patch2:
unchanged:
--- util-vserver-0.30.210.orig/scripts/vserver.functions
+++ util-vserver-0.30.210/scripts/vserver.functions
@@ -743,8 +743,8 @@
 
     test -n "$_HAVE_CHBIND_OPTIONS" || _generateChbindOptions "$cfgdir"
 
-    test -z "$NAMESPACE_CLEANUP" || isAvoidNamespace "$cfgdir" || \
-       $_VNAMESPACE --cleanup
+    isNamespaceCleanup "$cfgdir" || \
+        _namespaceCleanup
 
     _mountVserverInternal "$cfgdir"/fstab
     _mountVserverInternal "$cfgdir"/fstab.local
@@ -1099,3 +1099,29 @@
        _saveSingleDiskLimit "$vdir" "$dlimit"
     done
 }
+
+function _namespaceCleanup
+{
+    local root=$(readlink -f "$vdir")
+    local tmp="$root"
+    local list=""
+    while [ "$tmp" ]; do
+       list="$list $tmp"
+       tmp="${tmp%/*}"
+    done
+    local list_umount=""
+    while read dev path opts; do
+        [ "$path" ] || continue
+        for i in $root /dev /proc; do
+            [ "${path#$i}" != "$path" ] && continue 2
+        done
+        for i in $list /; do
+            [ "$path" = "$i" ] && continue 2
+        done
+        list_umount="$path $list_umount"
+    done < /proc/mounts
+    for i in $list_umount; do
+        umount $i
+    done
+}
+
only in patch2:
unchanged:
--- util-vserver-0.30.210.orig/scripts/functions
+++ util-vserver-0.30.210/scripts/functions
@@ -480,6 +480,18 @@
          -e "$cfgdir"/nonamespace
 }
 
+function isNamespaceCleanup
+{
+    local cfgdir
+
+    $_VSERVER_INFO - FEATURE namespace   || return 0
+    cfgdir=$($_VSERVER_INFO "$1" CFGDIR) || return 0
+    test -e "$cfgdir"/nonamespace-cleanup && return 0
+    test -e "$__CONFDIR"/.defaults/namespace-cleanup -o \
+         -e "$cfgdir"/namespace-cleanup && return 1
+    return 0
+}
+
 ## Usage: getAllVservers <var> [<KIND>*]
 function getAllVservers
 {
only in patch2:
unchanged:
--- util-vserver-0.30.210.orig/doc/configuration.xml
+++ util-vserver-0.30.210/doc/configuration.xml
@@ -37,6 +37,14 @@
       </description>
     </boolean>
 
+    <boolean id="global-namespace-cleanup" name="namespace-cleanup">
+      <description>
+Enable namespace cleanup globally. It can be overridden for a single vserver
+by setting the <optionref 
ref="global-nonamespace-cleanup">nonamespace-cleanup</optionref> flag
+there.
+      </description>
+    </boolean>
+
     <link name="run.rev">
       <description>
 Path of the vserver run reverse directory. This directory contains
@@ -344,6 +352,19 @@
       </description>
     </boolean>
 
+    <boolean id="global-nonamespace-cleanup" name="nonamespace-cleanup">
+      <description>
+Overrides the global <optionref 
ref="global-namespace-cleanup">namespace-cleanup</optionref> flag and disables
+namespace cleanup for the current vserver.
+      </description>
+    </boolean>
+
+    <boolean name="namespace-cleanup">
+      <description>
+Enable namespace cleanup for the current vserver.
+      </description>
+    </boolean>
+
     <hash name="schedule">
       <description>
 [experimental; name is subject of possible change] Contains the

Attachment: signature.asc
Description: Digital signature

Reply via email to