]> git.ipfire.org Git - thirdparty/util-linux.git/commit
unshare: allow persisting mount namespaces
authorKarel Zak <kzak@redhat.com>
Thu, 9 Apr 2015 09:48:07 +0000 (11:48 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 14 Apr 2015 09:39:15 +0000 (11:39 +0200)
commitc84f2590dfdb8570beeb731e0105f8fe597443d1
tree7ceb33f46188a0e6d0832e6e9580f805d148d30b
parent0490a6ca26f6e7bf9eed5521d240661adb302ba2
unshare: allow persisting mount namespaces

We can create a reference (bind mount) to the new namespace after
unshare(2), but it does not make sense to do it within unshared
namespace. (And if I read kernel fs/namespace.c: do_loopback()
correctly than copy mount bind mounts of /proc/<pid>/ns/mnt between
namespaces is unsupported.)

This patch bypass this problem by fork() where parent continue as
usually (call unshare(2), setup another things, etc.), but child
waits for /proc/[ppid]/ns/mnt inode number change (the ino is
changed after parent's unshare(2)) and then it bind mounts the new
namespaces and exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/unshare.c