chiark / gitweb /
switch-root: try pivot_root() before overmounting /
authorLennart Poettering <lennart@poettering.net>
Fri, 16 Nov 2012 17:15:30 +0000 (18:15 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 16 Nov 2012 17:21:09 +0000 (18:21 +0100)
commit891a4918ef75fa81e22691156c050d061bd53dd3
tree36509ed8a8446c83c0c59f1c15f6f354b1529909
parentc4eb3681c77329cb1ff9114e7f7274818c02da18
switch-root: try pivot_root() before overmounting /

We should always try to umount the old root dir if possible, instead of
overmounting it -- if that's possible.

The initial ("first") kernel rootfs can never be umounted, hence
for the usual nitrd case we never bothered using pivot_root() and
hence with fully unmounting it. However, fedup now tranisitions twice
during boot, and in that case it is highly desirable that the "second"
root dir is entirely unmounted when we switch to the "third". This patch
makes that possible.

The pivot_root() needs a directory in the "third" root dir, to move the
"second" root dir to. We use /mnt for that, under the assumption that
this directory is likely to exist, and is not itself a mount point.
src/core/switch-root.c