]> git.ipfire.org Git - thirdparty/systemd.git/commit
nspawn: split mount tunnel setup 25513/head
authorChristian Brauner <brauner@kernel.org>
Mon, 5 Dec 2022 17:34:00 +0000 (18:34 +0100)
committerChristian Brauner (Microsoft) <brauner@kernel.org>
Mon, 5 Dec 2022 17:35:02 +0000 (18:35 +0100)
commite79581ddfefd5d565bb3b497f1e6adae688c8810
tree294bd69bad1256e9446702956861dfe209651656
parentb71a0192c040f585397cfc6fc2ca025bf839733d
nspawn: split mount tunnel setup

Before we supported pivot_root() nspawn used to make the rootfs shared
before setting up the mount tunnel. So it was safe for it to just turn
it into a dependent mount during setup.

However, we cannot do this anymore because of the requirements
pivot_root() has. After the pivot_root() we will make the rootfs shared
recursively. If we turned the mount tunnel into dependent mount before
mount_switch_root() this will have the consequence that it becomes a
shared mount within the same peer group as the rootfs. So no mounts will
propagate into the container from the host anymore.

To fix this we split setting up the mount tunnel and making it active
into two steps. Setting up the mount tunnel is performed before
mount_switch_root() and activating it afterwards. Note that this works
because turning a shared mount into a shared mount is a nop. IOW, no new
peer group will be allocated.

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
src/nspawn/nspawn.c