summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_umount.c
diff options
context:
space:
mode:
authorKarel Zak2012-11-15 15:59:59 +0100
committerKarel Zak2012-11-15 15:59:59 +0100
commit224f5b92ac25208e41d342bd3bb082a056ae4d70 (patch)
treec540c0e24b9c5d281aa9eff89891bbf9ec7a935c /libmount/src/context_umount.c
parentlibmount: more robust tab filter usage (diff)
downloadkernel-qcow2-util-linux-224f5b92ac25208e41d342bd3bb082a056ae4d70.tar.gz
kernel-qcow2-util-linux-224f5b92ac25208e41d342bd3bb082a056ae4d70.tar.xz
kernel-qcow2-util-linux-224f5b92ac25208e41d342bd3bb082a056ae4d70.zip
libmount: don't try to play with loopdevs if umount argument is really mountpoint
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/context_umount.c')
-rw-r--r--libmount/src/context_umount.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 2c2e64c61..a31402cd9 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -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;