summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/common/recipes-phosphor
diff options
context:
space:
mode:
authorMilton Miller <miltonm@us.ibm.com>2016-02-05 17:26:04 -0600
committerMilton D. Miller II <miltonm@us.ibm.com>2016-02-09 11:11:24 -0600
commit7d9e2e4ae2c59fe69fd14c291db1caf61c9969ee (patch)
tree048bc13ee91c0a2129be28018a7118e16065e64f /meta-phosphor/common/recipes-phosphor
parentdbacf104885c3bf78c5f3e06f63bba6db0742e4b (diff)
downloadtalos-openbmc-7d9e2e4ae2c59fe69fd14c291db1caf61c9969ee.tar.gz
talos-openbmc-7d9e2e4ae2c59fe69fd14c291db1caf61c9969ee.zip
obmc-initfs: shutdown when rofs is a loop mounted image in /run
If one sets rodir=/run/image-rofs roopts=ro,loop and transfers an image one can run from a base image in ram. However, the shutdown will fail to unmount /run because it is busy and then fails to unmount /cow which causes oldroot to be still mounted. By moving the mount to the side everything cleans up (as long as there are no other mounts under run, and systemd-shutdown tried to do as much as possible). Signed-off-by: Milton Miller <miltonm@us.ibm.com>
Diffstat (limited to 'meta-phosphor/common/recipes-phosphor')
-rw-r--r--meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
index 7d1157a05..3eff1ea85 100644
--- a/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
+++ b/meta-phosphor/common/recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh
@@ -15,11 +15,16 @@ else
umount_proc=
fi
-# remove an empty oldroot, that means we are not invoked from systemd-shutdown
+# Remove an empty oldroot, that means we are not invoked from systemd-shutdown
rmdir /oldroot 2>/dev/null
+# Move /oldroot/run to /mnt in case it has the underlying rofs loop mounted.
+# Ordered before /oldroot the overlay is unmounted before the loop mount
+mkdir -p /mnt
+mount --move /oldroot/run /mnt
+
set -x
-for f in $( awk '/oldroot/ { print $2 }' < /proc/mounts | sort -r )
+for f in $( awk '/oldroot|mnt/ { print $2 }' < /proc/mounts | sort -r )
do
umount $f
done
OpenPOWER on IntegriCloud