util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: harald@redhat.com
To: util-linux@vger.kernel.org
Cc: Harald Hoyer <harald@redhat.com>
Subject: [PATCH] switch_root.c: umount mount points we cannot move with MNT_DETACH
Date: Mon, 14 Nov 2011 14:11:01 +0100	[thread overview]
Message-ID: <1321276261-9165-1-git-send-email-harald@redhat.com> (raw)

From: Harald Hoyer <harald@redhat.com>

If a mount point cannot be moved to the new root, umount it with
MNT_DETACH, so that it is lazy umounted and does not show up in
/proc/mounts anymore.
---
 sys-utils/switch_root.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c
index e50f310..a49a1f7 100644
--- a/sys-utils/switch_root.c
+++ b/sys-utils/switch_root.c
@@ -131,7 +131,7 @@ static int switchroot(const char *newroot)
 
 		if ((stat(newmount, &sb) != 0) || (sb.st_dev != newroot_stat.st_dev)) {
 			/* mount point seems to be mounted already or stat failed */
-			umount(umounts[i]);
+			umount2(umounts[i], MNT_DETACH);
 			continue;
 		}
 
-- 
1.7.7


             reply	other threads:[~2011-11-14 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14 13:11 harald [this message]
2011-11-14 13:51 ` [PATCH] switch_root.c: umount mount points we cannot move with MNT_DETACH Karel Zak

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=1321276261-9165-1-git-send-email-harald@redhat.com \
    --to=harald@redhat.com \
    --cc=util-linux@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).