dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/2.24-libmount-canonicalize-for-conversion-from-loopdev.patch

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