dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
6717ab
From 3f420a49dd4d0c413b635dd621aa34eebce2d3d2 Mon Sep 17 00:00:00 2001
6717ab
From: Karel Zak <kzak@redhat.com>
6717ab
Date: Mon, 5 Aug 2013 13:58:01 +0200
6717ab
Subject: [PATCH] libmount: canonicalize for conversion from loopdev backing
6717ab
 file
6717ab
6717ab
  # mount foo.img /mnt
6717ab
  # umount foo.img
6717ab
  umount: foo.img: not mounted
6717ab
6717ab
The loopdev code (and sysfs backing_file) uses absolute paths, but
6717ab
libmount does not canonicalize the path before lookup for the backing file.
6717ab
6717ab
References: https://bugzilla.redhat.com/show_bug.cgi?id=950497
6717ab
Signed-off-by: Karel Zak <kzak@redhat.com>
6717ab
---
6717ab
 libmount/src/context_umount.c | 7 ++++++-
6717ab
 1 file changed, 6 insertions(+), 1 deletion(-)
6717ab
6717ab
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
6717ab
index 2b791c4..b02902c 100644
6717ab
--- a/libmount/src/context_umount.c
6717ab
+++ b/libmount/src/context_umount.c
6717ab
@@ -161,7 +161,12 @@ try_loopdev:
6717ab
 		struct stat st;
6717ab
 
6717ab
 		if (stat(tgt, &st) == 0 && S_ISREG(st.st_mode)) {
6717ab
-			int count = loopdev_count_by_backing_file(tgt, &loopdev);
6717ab
+			int count;
6717ab
+
6717ab
+			cn_tgt = mnt_resolve_path(tgt, cache);
6717ab
+			count = loopdev_count_by_backing_file(cn_tgt, &loopdev);
6717ab
+			if (!cache)
6717ab
+				free(cn_tgt);
6717ab
 			if (count == 1) {
6717ab
 				DBG(CXT, mnt_debug_h(cxt,
6717ab
 					"umount: %s --> %s (retry)", tgt, loopdev));
6717ab
-- 
6717ab
1.8.1.4
6717ab