Blob Blame History Raw
From b6c9ebe86c45d0a318ec9bb42a6373b4f77a1ba7 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Tue, 21 Jul 2015 16:15:30 -0700
Subject: [PATCH 1/1] fix device path canonicalization by using libmount cache

---
 usr/initiator.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/usr/initiator.c b/usr/initiator.c
index 3b39c5d..0519d46 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -2141,12 +2141,14 @@ static int session_unbind(struct iscsi_session *session)
 }
 
 static struct libmnt_table *mtab, *swaps;
+static struct libmnt_cache *mntcache;
 
 static void libmount_cleanup(void)
 {
 	mnt_free_table(mtab);
 	mnt_free_table(swaps);
-	mtab = swaps = NULL;
+	mnt_free_cache(mntcache);
+	mtab = swaps = mntcache = NULL;
 }
 
 static int libmount_init(void)
@@ -2154,10 +2156,13 @@ static int libmount_init(void)
 	mnt_init_debug(0);
 	mtab = mnt_new_table();
 	swaps = mnt_new_table();
-	if (!mtab || !swaps) {
+	mntcache = mnt_new_cache();
+	if (!mtab || !swaps || !mntcache) {
 		libmount_cleanup();
 		return -ENOMEM;
 	}
+	mnt_table_set_cache(mtab, mntcache);
+	mnt_table_set_cache(swaps, mntcache);
 	mnt_table_parse_mtab(mtab, NULL);
 	mnt_table_parse_swaps(swaps, NULL);
 	return 0;
-- 
2.1.0