Skip to contentSkip to conversation

switch_root.c: umount mount points we cannot move with MNT_DETACH

PATCH Applied [email protected] 2 participants 2 messages Nov 14, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 switch_root.c: umount mount points we cannot move with MNT_DETACH

From: Harald Hoyer <[email protected]>

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(-)
sys-utils/switch_root.c +1 -1
index e50f310..a49a1f7 100644
@@ -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;
 		}
 
Signature · 1 line
1.7.7
maintainer Applied
#1 lore raw
Quoted 2 lines · On Mon, Nov 14, 2011 at 02:11:01PM +0100, [email protected] wrote:
 sys-utils/switch_root.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com