All of lore.kernel.org
 help / color / mirror / Atom feed
From: OpenBMC Patches <openbmc-patches@stwcx.xyz>
To: openbmc@lists.ozlabs.org
Subject: [PATCH openbmc 7/7] obmc-initfs: shutdown when rofs is a loop mounted image in /run
Date: Sat,  6 Feb 2016 18:00:21 -0600	[thread overview]
Message-ID: <1454803221-12014-8-git-send-email-openbmc-patches@stwcx.xyz> (raw)
In-Reply-To: <1454803221-12014-1-git-send-email-openbmc-patches@stwcx.xyz>

From: Milton Miller <miltonm@us.ibm.com>

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>
---
 .../recipes-phosphor/obmc-phosphor-initfs/files/obmc-shutdown.sh | 9 +++++++--
 1 file 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 7d1157a..3eff1ea 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
-- 
2.6.4

  parent reply	other threads:[~2016-02-07  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-07  0:00 [PATCH openbmc 0/7] initfs: check and auto-repair read/write file system OpenBMC Patches
2016-02-07  0:00 ` [PATCH openbmc 1/7] obmc-initfs: minor updates OpenBMC Patches
2016-02-08 16:25   ` Brad Bishop
2016-02-09  0:55   ` Andrew Jeffery
2016-02-07  0:00 ` [PATCH openbmc 2/7] obmc-initfs: look for images in /run/initramfs/image- OpenBMC Patches
2016-02-08 16:25   ` Brad Bishop
2016-02-07  0:00 ` [PATCH openbmc 3/7] obmc-initfs: use varables for paths and mount arguments OpenBMC Patches
2016-02-08 16:37   ` Brad Bishop
2016-02-09  0:46   ` Andrew Jeffery
2016-02-07  0:00 ` [PATCH openbmc 4/7] obmc-initfs: factor debug and takeover OpenBMC Patches
2016-02-08 16:58   ` Brad Bishop
2016-02-07  0:00 ` [PATCH openbmc 5/7] obmc-initfs: run fsck on read/write file system OpenBMC Patches
2016-02-08 17:03   ` Brad Bishop
2016-02-07  0:00 ` [PATCH openbmc 6/7] obmc-initfs: run update as a sub-script OpenBMC Patches
2016-02-08 17:05   ` Brad Bishop
2016-02-07  0:00 ` OpenBMC Patches [this message]
2016-02-08 17:07   ` [PATCH openbmc 7/7] obmc-initfs: shutdown when rofs is a loop mounted image in /run Brad Bishop
  -- strict thread matches above, loose matches on Subject: below --
2016-02-06  0:20 [PATCH openbmc 0/7] initfs: check and auto-repair read/write file system OpenBMC Patches
2016-02-06  0:20 ` [PATCH openbmc 7/7] obmc-initfs: shutdown when rofs is a loop mounted image in /run OpenBMC Patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454803221-12014-8-git-send-email-openbmc-patches@stwcx.xyz \
    --to=openbmc-patches@stwcx.xyz \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.