Blame SOURCES/0038-multipath-deal-with-failures-flushing-maps.patch

b7337d
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
b7337d
From: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
Date: Mon, 13 Jul 2020 15:41:15 -0500
b7337d
Subject: [PATCH] multipath: deal with failures flushing maps
b7337d
b7337d
dm_flush_maps() was failing if there were no device-mapper devices at
b7337d
all, instead of returning success, since there is nothing to do.
b7337d
b7337d
delegate_to_multipathd() was returning success, even if the multipathd
b7337d
command failed. Also, if the command was set to fail with NOT_DELEGATED,
b7337d
it shouldn't print any errors, since multipath will try to issue to
b7337d
command itself.
b7337d
b7337d
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
b7337d
---
b7337d
 libmultipath/devmapper.c | 2 +-
b7337d
 multipath/main.c         | 9 ++++++---
b7337d
 2 files changed, 7 insertions(+), 4 deletions(-)
b7337d
b7337d
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
b7337d
index 91ff0b3d..3f70e576 100644
b7337d
--- a/libmultipath/devmapper.c
b7337d
+++ b/libmultipath/devmapper.c
b7337d
@@ -970,10 +970,10 @@ int dm_flush_maps (int need_suspend, int retries)
b7337d
 	if (!(names = dm_task_get_names (dmt)))
b7337d
 		goto out;
b7337d
 
b7337d
+	r = 0;
b7337d
 	if (!names->dev)
b7337d
 		goto out;
b7337d
 
b7337d
-	r = 0;
b7337d
 	do {
b7337d
 		if (need_suspend)
b7337d
 			r |= dm_suspend_and_flush_map(names->name, retries);
b7337d
diff --git a/multipath/main.c b/multipath/main.c
b7337d
index 3c3d2398..607cada2 100644
b7337d
--- a/multipath/main.c
b7337d
+++ b/multipath/main.c
b7337d
@@ -869,9 +869,12 @@ int delegate_to_multipathd(enum mpath_cmds cmd,
b7337d
 		goto out;
b7337d
 	}
b7337d
 
b7337d
-	if (reply != NULL && *reply != '\0' && strcmp(reply, "ok\n"))
b7337d
-		printf("%s", reply);
b7337d
-	r = DELEGATE_OK;
b7337d
+	if (reply != NULL && *reply != '\0') {
b7337d
+		if (strcmp(reply, "fail\n"))
b7337d
+			r = DELEGATE_OK;
b7337d
+		if (r != NOT_DELEGATED && strcmp(reply, "ok\n"))
b7337d
+			printf("%s", reply);
b7337d
+	}
b7337d
 
b7337d
 out:
b7337d
 	FREE(reply);
b7337d
-- 
b7337d
2.17.2
b7337d