[Lxc-users] lxc-start fails when / is a shared mount

Ram Pai linuxram at us.ibm.com
Tue Sep 20 01:53:27 UTC 2011


On Mon, Sep 19, 2011 at 11:38:27AM -0500, Serge E. Hallyn wrote:
> It'd be worth asking Ram about that.  It's possible he was being overly
> cautious as this was new ground, but it seems likely there was a good
> reason for it.
> 
> Heck, rather than guessing,  cc:ing Ram.  Ram, can you explain the need
> for all three parts of that check at pivot_root():
> 
> +       if (IS_MNT_SHARED(old_nd.mnt) ||
> +               IS_MNT_SHARED(new_nd.mnt->mnt_parent) ||
> +               IS_MNT_SHARED(user_nd.mnt->mnt_parent))
> 
> ?

digging through my long lost memory..... hmm..ok here is my recollection.

Pivot root involves two move-mount operations. We had decided to not allow
moving a mount that is currently below a shared mount. The reason being; it will
lead to unmount of all the trees under their corresponding peer mounts.

Since pivot_root involves two atomic move-mount operations, and since
moving mounts below shared mounts is a invalid operation, the pivot_root
operation below shared mounts becomes a invalid operation.


RP

> 
> thanks,
> -serge
> 
> Quoting Marios Titas (redneb8888 at gmail.com):
> > It seems that the kernel commit
> > 2144440327fa01b2f3f65e355120a78211685702 from 2005 is the culprit.
> > It's the commit that implemented mount --move in presense of shared
> > mounts. It added a check in fs/namespace.c that makes pivot_root fail
> > when the old root is marked as a shared mount. I don't understand the
> > reason for that.
> > 
> > 
> > On Mon, Sep 19, 2011 at 09:35, Serge Hallyn <serge.hallyn at canonical.com> wrote:
> > > Quoting Marios Titas (redneb8888 at gmail.com):
> > >> Hi list,
> > >>
> > >> I just ran into this problem: If you do
> > >>     # mount --make-shared /
> > >> to mark / as a shared mount then lxc-start fails when you have
> > >> specified a lxc.rootfs in the configuration file. The error that
> > >> lxc-start gives is the following:
> > >>     Invalid argument - pivot_root syscall failed
> > >> Is this the normal behavior or is this a kernel bug?
> > >
> > > It is normal behavior.  Perhaps lxc should fall back to chroot when
> > > pivot_root fails.
> > >
> > > -serge
> > >




More information about the lxc-users mailing list