Blame SOURCES/0112-libmultipath-return-success-if-we-raced-to-remove-a-.patch

108c2a
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
108c2a
From: Benjamin Marzinski <bmarzins@redhat.com>
108c2a
Date: Tue, 9 Aug 2022 16:46:27 -0500
108c2a
Subject: [PATCH] libmultipath: return success if we raced to remove a map and
108c2a
 lost
108c2a
108c2a
_dm_flush_map() was returning failure if it failed to remove a map,
108c2a
even if that was because the map had already been removed. Return
108c2a
success in this case.
108c2a
108c2a
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
108c2a
Reviewed-by: Martin Wilck <mwilck@suse.com>
108c2a
---
108c2a
 libmultipath/devmapper.c | 4 ++++
108c2a
 multipathd/main.c        | 4 ----
108c2a
 2 files changed, 4 insertions(+), 4 deletions(-)
108c2a
108c2a
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
108c2a
index e3c3c119..ee81acc3 100644
108c2a
--- a/libmultipath/devmapper.c
108c2a
+++ b/libmultipath/devmapper.c
108c2a
@@ -916,6 +916,10 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
108c2a
 			}
108c2a
 			condlog(4, "multipath map %s removed", mapname);
108c2a
 			return 0;
108c2a
+		} else if (dm_is_mpath(mapname) != 1) {
108c2a
+			condlog(4, "multipath map %s removed externally",
108c2a
+				mapname);
108c2a
+			return 0; /*we raced with someone else removing it */
108c2a
 		} else {
108c2a
 			condlog(2, "failed to remove multipath map %s",
108c2a
 				mapname);
108c2a
diff --git a/multipathd/main.c b/multipathd/main.c
108c2a
index 9b1098f6..9eafd5b7 100644
108c2a
--- a/multipathd/main.c
108c2a
+++ b/multipathd/main.c
108c2a
@@ -673,10 +673,6 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
108c2a
 	 * the spurious uevent we may generate with the dm_flush_map call below
108c2a
 	 */
108c2a
 	if (r) {
108c2a
-		/*
108c2a
-		 * May not really be an error -- if the map was already flushed
108c2a
-		 * from the device mapper by dmsetup(8) for instance.
108c2a
-		 */
108c2a
 		if (r == 1)
108c2a
 			condlog(0, "%s: can't flush", mpp->alias);
108c2a
 		else {