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