Blame SOURCES/open-iscsi-0007-iscsid-safe_logout-fix-device-path-canonicalizati.patch

d087b3
From 3f1b9160dc8ffc6e7196a24885781e1ba82f9119 Mon Sep 17 00:00:00 2001
6cc97b
From: Chris Leech <cleech@redhat.com>
6cc97b
Date: Tue, 21 Jul 2015 16:15:30 -0700
d087b3
Subject: [PATCH v2 7/9] iscsid: safe_logout fix device path canonicalization
d087b3
 by using libmount cache
6cc97b
d087b3
Fix for the safe_logout options use of libmount.  If the cache API isn't
d087b3
used then device name canonicalization doesn't happen, and proper
d087b3
detection of devices mounted by a label doesn't work.
6cc97b
---
6cc97b
 usr/initiator.c | 9 +++++++--
6cc97b
 1 file changed, 7 insertions(+), 2 deletions(-)
6cc97b
6cc97b
diff --git a/usr/initiator.c b/usr/initiator.c
d087b3
index 8cd1896..b0f0147 100644
6cc97b
--- a/usr/initiator.c
6cc97b
+++ b/usr/initiator.c
d087b3
@@ -2045,12 +2045,14 @@ static int session_unbind(struct iscsi_session *session)
6cc97b
 }
6cc97b
 
6cc97b
 static struct libmnt_table *mtab, *swaps;
6cc97b
+static struct libmnt_cache *mntcache;
6cc97b
 
6cc97b
 static void libmount_cleanup(void)
6cc97b
 {
6cc97b
 	mnt_free_table(mtab);
6cc97b
 	mnt_free_table(swaps);
6cc97b
-	mtab = swaps = NULL;
6cc97b
+	mnt_free_cache(mntcache);
6cc97b
+	mtab = swaps = mntcache = NULL;
6cc97b
 }
6cc97b
 
6cc97b
 static int libmount_init(void)
d087b3
@@ -2058,10 +2060,13 @@ static int libmount_init(void)
6cc97b
 	mnt_init_debug(0);
6cc97b
 	mtab = mnt_new_table();
6cc97b
 	swaps = mnt_new_table();
6cc97b
-	if (!mtab || !swaps) {
6cc97b
+	mntcache = mnt_new_cache();
6cc97b
+	if (!mtab || !swaps || !mntcache) {
6cc97b
 		libmount_cleanup();
6cc97b
 		return -ENOMEM;
6cc97b
 	}
6cc97b
+	mnt_table_set_cache(mtab, mntcache);
6cc97b
+	mnt_table_set_cache(swaps, mntcache);
6cc97b
 	mnt_table_parse_mtab(mtab, NULL);
6cc97b
 	mnt_table_parse_swaps(swaps, NULL);
6cc97b
 	return 0;
6cc97b
-- 
d087b3
2.5.5
6cc97b