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