Blame SOURCES/0062-libmultipath-select_action-don-t-drop-map-if-alias-c.patch

b46d12
From 7a7b96246b84ccf533a6f4dc0424830792fdb96a Mon Sep 17 00:00:00 2001
b46d12
From: Martin Wilck <mwilck@suse.com>
b46d12
Date: Fri, 3 Jul 2020 15:17:09 +0200
b46d12
Subject: [PATCH] libmultipath: select_action(): don't drop map if alias
b46d12
 clashes
b46d12
b46d12
If for a given map, if we find that the requested alias is already
b46d12
used by a map with different WWID, while the map's own WWID is
b46d12
not used yet, give up the alias and use the WWID instead. This
b46d12
is safer than trying to destroy the existing map, which is likely
b46d12
to fail.
b46d12
b46d12
This allows us to make use const for the "curmp" parameter.
b46d12
b46d12
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
b46d12
---
b46d12
 libmultipath/configure.c | 11 ++++++-----
b46d12
 1 file changed, 6 insertions(+), 5 deletions(-)
b46d12
b46d12
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
b46d12
index b7113291..2e8f34f9 100644
b46d12
--- a/libmultipath/configure.c
b46d12
+++ b/libmultipath/configure.c
b46d12
@@ -690,12 +690,13 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
b46d12
 	}
b46d12
 
b46d12
 	if (!cmpp) {
b46d12
-		condlog(2, "%s: remove (wwid changed)", mpp->alias);
b46d12
-		dm_flush_map(mpp->alias);
b46d12
-		strlcpy(cmpp_by_name->wwid, mpp->wwid, WWID_SIZE);
b46d12
-		drop_multipath(curmp, cmpp_by_name->wwid, KEEP_PATHS);
b46d12
+		condlog(1, "%s: can't use alias \"%s\" used by %s, falling back to WWID",
b46d12
+			mpp->wwid, mpp->alias, cmpp_by_name->wwid);
b46d12
+		/* We can do this because wwid wasn't found */
b46d12
+		free(mpp->alias);
b46d12
+		mpp->alias = strdup(mpp->wwid);
b46d12
 		mpp->action = ACT_CREATE;
b46d12
-		condlog(3, "%s: set ACT_CREATE (map wwid change)",
b46d12
+		condlog(3, "%s: set ACT_CREATE (map does not exist, name changed)",
b46d12
 			mpp->alias);
b46d12
 		return;
b46d12
 	}
b46d12
-- 
b46d12
2.17.2
b46d12