How do I make a clean mount namespace?

From: Andy Lutomirski
Date: Tue Apr 22 2014 - 18:12:44 EST


I want to set up a little container. So I unshare the mount namespace
and mount something somewhere (say /mnt) that I want to be my new
root. Now what?

pivot_root("/mnt", "/mnt/garbage") seems to frequently return -EBUSY.

mounting /mnt onto / using MS_MOVE seems to succeed, but / still
points at the old root.

Am I missing a clean way to do this? I want a way to say "make this
mountpoint be the root of the whole mount namespace and lazy-unmount
everything outside it". If there is no straightforward way to do
that, can we add one?

--Andy

--
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/