]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: don't try to play with loopdevs if umount argument is really mountpoint
authorKarel Zak <kzak@redhat.com>
Thu, 15 Nov 2012 14:59:59 +0000 (15:59 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 15 Nov 2012 14:59:59 +0000 (15:59 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_umount.c

index 2c2e64c614cdd2765a0f1c9b78dd271bbd1f8755..a31402cd9704c26f3d672f76f5425322b79fda16 100644 (file)
@@ -112,7 +112,10 @@ static int lookup_umount_fs(struct libmnt_context *cxt)
 try_loopdev:
        fs = mnt_table_find_target(mtab, tgt, MNT_ITER_BACKWARD);
        if (!fs && mnt_context_is_swapmatch(cxt)) {
-               /* maybe the option is source rather than target (mountpoint) */
+               /*
+                * Maybe the option is source rather than target (sometimes
+                * people use e.g. "umount /dev/sda1")
+                */
                fs = mnt_table_find_source(mtab, tgt, MNT_ITER_BACKWARD);
 
                if (fs) {
@@ -135,9 +138,9 @@ try_loopdev:
                }
        }
 
-       if (!fs && !loopdev) {
+       if (!fs && !loopdev && mnt_context_is_swapmatch(cxt)) {
                /*
-                * Maybe target is /path/file.img, try to convert to /dev/loopN
+                * Maybe the option is /path/file.img, try to convert to /dev/loopN
                 */
                struct stat st;