Fix for the safe_logout options use of libmount.  If the cache API isn't
used then device name canonicalization doesn't happen, and proper
detection of devices mounted by a label doesn't work.

Signed-off-by: Chris Leech <[email protected]>
---
 usr/initiator.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/usr/initiator.c b/usr/initiator.c
index 8cd1896..b0f0147 100644
--- a/usr/initiator.c
+++ b/usr/initiator.c
@@ -2045,12 +2045,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)
@@ -2058,10 +2060,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.5.5

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to