[lxc-devel] Why pivot_root()?

Rob Landley rlandley at parallels.com
Sat Apr 23 22:46:54 UTC 2011


I'm reading through the LXC code and for some reason it's using
pivot_root() instead of chroot().  Is there a reason for this?  (We need
to iterate through every process in the system and make sure that kernel
threads that are the children of the host's PID 1 get evicted from the
old mount point so we can umount it?  But the host context isn't going
away when we launch a container...)

I thought that syscall was created to dispose of initrd so the system
could free the ramdisk block device without the kernel threads that were
reparented to init pinning the mount point, and one of the big
advantages of initramfs is it _didn't_ need to call that particular
piece of black magic (because initramfs provides a low-overhead place to
park daemonized kernel threads).

What's the advantage of using it here?

Rob




More information about the lxc-devel mailing list