diff options
author | Karel Zak | 2012-04-02 17:34:07 +0200 |
---|---|---|
committer | Karel Zak | 2012-04-02 17:34:07 +0200 |
commit | 72bec4d0dd5c94f15ed7c17d3452ba87ed737209 (patch) | |
tree | f1d06a747eb07e44012d94c5e5816e96c3327d58 | |
parent | lib/loopdev: more robust initialization (diff) | |
download | kernel-qcow2-util-linux-72bec4d0dd5c94f15ed7c17d3452ba87ed737209.tar.gz kernel-qcow2-util-linux-72bec4d0dd5c94f15ed7c17d3452ba87ed737209.tar.xz kernel-qcow2-util-linux-72bec4d0dd5c94f15ed7c17d3452ba87ed737209.zip |
mount: (old) check for LD_FLAGS_AUTOCLEAR more carefully
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=803799
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | mount/umount.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/mount/umount.c b/mount/umount.c index a6fcd333c..71cc0ee58 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -276,7 +276,6 @@ umount_one (const char *spec, const char *node, const char *type, int extra_flags = 0; const char *loopdev, *target = node; char *targetbuf = NULL; - int myloop = 0; /* Special case for root. As of 0.99pl10 we can (almost) unmount root; the kernel will remount it readonly so that we can carry on running @@ -301,12 +300,6 @@ umount_one (const char *spec, const char *node, const char *type, /* Skip the actual umounting for --fake */ if (fake) goto writemtab; - /* - * Ignore the option "-d" for non-loop devices and loop devices with - * LO_FLAGS_AUTOCLEAR flag. - */ - if (delloop && is_loopdev(spec)) - myloop = 1; if (restricted) { if (umount_nofollow_support()) @@ -409,12 +402,21 @@ umount_one (const char *spec, const char *node, const char *type, } /* Also free loop devices when -d flag is given */ - if (myloop) + if (delloop) loopdev = spec; } gotloop: - if (loopdev && !loopdev_is_autoclear(loopdev)) - loopdev_delete(loopdev); + if (loopdev) { + struct loopdev_cxt lc; + + loopcxt_init(&lc, 0); + loopcxt_set_device(&lc, loopdev); + + if (loopcxt_get_backing_file(&lc) + && loopcxt_is_autoclear(&lc) == 0) + loopcxt_delete_device(&lc); + loopcxt_deinit(&lc); + } writemtab: if (!nomtab && |