device-mapper-multipath/SOURCES/0062-libmultipath-select_action-don-t-drop-map-if-alias-c.patch

46 lines
1.6 KiB
Diff
Raw Normal View History

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