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

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