]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/start.c
Support MS_SHARED /
authorSerge Hallyn <serge.hallyn@canonical.com>
Thu, 20 Dec 2012 05:58:44 +0000 (23:58 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Thu, 20 Dec 2012 09:51:01 +0000 (10:51 +0100)
commitcc28d0b0a66bd956645dc7b8fc85b917711f2472
treec9322723904f6259a60b54887e0a295c2e0f941f
parent963aef6f7f127c43cded0fe628a1b00fe9afb16e
Support MS_SHARED /

(I'll be out until Jan 2, but in the meantime, here is hopefully a
little newyears gift - this seems to allow lxc-start with / being
MS_SHARED on the host)

When / is MS_SHARED (for instance with f18 and modern arch), lxc-start
fails on pivot_root.  The kernel enforces that, when doing pivot_root,
the parent of current->fs->root (as well as the new root and the putold
location) not be MS_SHARED.

To work around this, check /proc/self/mountinfo for a 'shared:' in
the '/' line.  If it is there, then create a tiny MS_SLAVE tmpfs dir to
serve as parent of /, recursively bind mount / into /root under that dir,
make it rslave, and chroot into it.

Tested with ubuntu raring image after doing 'mount --make-rshared /'.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c
src/lxc/conf.h
src/lxc/start.c