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

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