diff options
author | Karel Zak | 2013-08-05 13:58:01 +0200 |
---|---|---|
committer | Karel Zak | 2013-08-05 13:58:01 +0200 |
commit | 3f420a49dd4d0c413b635dd621aa34eebce2d3d2 (patch) | |
tree | a3d03bba3f78b071f11bfd2408f7d0005cd48a23 /libmount/src | |
parent | cal: set statically defined data read-only (diff) | |
download | kernel-qcow2-util-linux-3f420a49dd4d0c413b635dd621aa34eebce2d3d2.tar.gz kernel-qcow2-util-linux-3f420a49dd4d0c413b635dd621aa34eebce2d3d2.tar.xz kernel-qcow2-util-linux-3f420a49dd4d0c413b635dd621aa34eebce2d3d2.zip |
libmount: canonicalize for conversion from loopdev backing file
# mount foo.img /mnt
# umount foo.img
umount: foo.img: not mounted
The loopdev code (and sysfs backing_file) uses absolute paths, but
libmount does not canonicalize the path before lookup for the backing file.
References: https://bugzilla.redhat.com/show_bug.cgi?id=950497
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src')
-rw-r--r-- | libmount/src/context_umount.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 2b791c44d..b02902c45 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -161,7 +161,12 @@ try_loopdev: struct stat st; if (stat(tgt, &st) == 0 && S_ISREG(st.st_mode)) { - int count = loopdev_count_by_backing_file(tgt, &loopdev); + int count; + + cn_tgt = mnt_resolve_path(tgt, cache); + count = loopdev_count_by_backing_file(cn_tgt, &loopdev); + if (!cache) + free(cn_tgt); if (count == 1) { DBG(CXT, mnt_debug_h(cxt, "umount: %s --> %s (retry)", tgt, loopdev)); |