]> git.ipfire.org Git - thirdparty/systemd.git/commit
Revert "shutdown: do not umount recursively before MS_MOVE" 28793/head
authorLennart Poettering <lennart@poettering.net>
Fri, 11 Aug 2023 10:15:25 +0000 (12:15 +0200)
committerMike Yuan <me@yhndnzj.com>
Sat, 2 Sep 2023 11:47:58 +0000 (19:47 +0800)
commitc6c5d20de5a68797b49eef4486dca308b39e48ae
tree971be3354219151f4f3124eb2174989fe3e556f7
parent95648f9ed0d972c3ad86205a462bb5805498ee58
Revert "shutdown: do not umount recursively before MS_MOVE"

This reverts commit 6b219b74de53729249956221a971047aab7c96e0.

This commit doesn't look right to me. We have to unmount everything
recursively *before* we MS_MOVE because the MS_MOVE will not get rid of
it for us, and we simply cannot access these mounts after the MS_MOVE is
complete anymore.

This is a fundamental difference between MS_MOVE and pivot_root(). The
latter repivots the entire mount table getting rid of anything outside
of the new root. MS_MOVE otoh just mounts a bunch of mount points to the
top, leaving in place whatever might be underneath it.

Thus, if we go through the MS_MOVE codepath we must unmount everything
explicitly before doing so because otherwise the mounts will be pinned
forever, but be entirely invisble to userspace.
src/shared/switch-root.c
src/shared/switch-root.h
src/shutdown/shutdown.c