forked from systemd/systemd
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch-root: always use MS_BIND to move api vfs over
We previously would use MS_MOVE to move the old procfs, sysfs, /dev/ and /run to the new place in some places, and MS_BIND in others. The logic when to use MS_MOVE and when to use MS_BIND was pretty arbitrary so far: we'd use MS_MOVE during the initrd → host transition and MS_BIND when transitioning from host into the exitrd during shutdown. Traditionally, using MS_MOVE was preferable, because we didn't bother with unmounting the old mount hierarchy before the switch root, and thus using MS_MOVE did some clean-up as side-effect (because the old mounts went away this way). But since we nowadays properly umount all remaining mount points (since 268d124) when transitioning it's pointless. Let's just use MS_BIND always. Let's tweak it though: let's use MS_BIND|MS_REC for the kernel API VFS, and MS_BIND without MS_REC for /run/. The latter reflects the fact that the submounts /run/ has usually are not so much about just accessing kernel APIs but about auxiliary user resources. Hence let's only move the main mount over for that. While we are at it, also set up the base filesystem *before* we move the mounts from the old to the new root, since the base filesystem setup logic creates various needed inodes for us, which we really should make use of instead of creating on our own.
- Loading branch information
1 parent
34f21ff
commit 7c764d4
Showing
4 changed files
with
40 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters