[dm-devel] [PATCH 2/3] libmultipath: return success if we raced to remove a map and lost

Benjamin Marzinski bmarzins at redhat.com
Tue Aug 9 21:46:27 UTC 2022


_dm_flush_map() was returning failure if it failed to remove a map,
even if that was because the map had already been removed. Return
success in this case.

Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
---
 libmultipath/devmapper.c | 4 ++++
 multipathd/main.c        | 4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 1748d258..a49db3b0 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -1111,6 +1111,10 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
 			}
 			condlog(4, "multipath map %s removed", mapname);
 			return 0;
+		} else if (dm_is_mpath(mapname) != 1) {
+			condlog(4, "multipath map %s removed externally",
+				mapname);
+			return 0; /*we raced with someone else removing it */
 		} else {
 			condlog(2, "failed to remove multipath map %s",
 				mapname);
diff --git a/multipathd/main.c b/multipathd/main.c
index 325f8cd4..1380dd8b 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -758,10 +758,6 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
 	 * the spurious uevent we may generate with the dm_flush_map call below
 	 */
 	if (r) {
-		/*
-		 * May not really be an error -- if the map was already flushed
-		 * from the device mapper by dmsetup(8) for instance.
-		 */
 		if (r == 1)
 			condlog(0, "%s: can't flush", mpp->alias);
 		else {
-- 
2.17.2



More information about the dm-devel mailing list