delete the mount namespace on stop
[newns] / newns
diff --git a/newns b/newns
index d60c0bcec3c43cccab802fcf2c5faca3492ffed6..aff500b5ecc0f0795121ac05a7c910aafec53bad 100755 (executable)
--- a/newns
+++ b/newns
@@ -38,6 +38,7 @@ fi
 usage() {
     cat <<EOF
 usage: ${0##*/} [OPTS] start|stop NETNS_NAME
+Setup new or systemd created network namespace with nat and mount namespace
 
 -c, --create    Create network namespace. For running outside systemd private net.
 -h, --help      Show this help and exit.
@@ -210,6 +211,9 @@ stop() {
     if $create; then
         ip netns del $nn
     fi
+    if mountpoint /root/mount_namespaces/$nn >/dev/null; then
+        umount /root/mount_namespaces/$nn
+    fi
 }
 
 case $action in