|
|
785c99 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
785c99 |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
785c99 |
Date: Tue, 16 Jun 2020 16:25:34 -0500
|
|
|
785c99 |
Subject: [PATCH] multipath: delegate flushing maps to multipathd
|
|
|
785c99 |
|
|
|
785c99 |
Since there can be problems with removing maps outside of multipathd,
|
|
|
785c99 |
multipath should attempt to delegate this command to multipathd.
|
|
|
785c99 |
However, multipathd doesn't attempt to suspend the device, in order
|
|
|
785c99 |
to avoid potential hangs. If delegating to multipathd fails, multipath
|
|
|
785c99 |
should try the remove itself.
|
|
|
785c99 |
|
|
|
785c99 |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
785c99 |
---
|
|
|
785c99 |
multipath/main.c | 14 ++++++++++++++
|
|
|
785c99 |
multipath/multipath.8 | 4 ++--
|
|
|
785c99 |
2 files changed, 16 insertions(+), 2 deletions(-)
|
|
|
785c99 |
|
|
|
785c99 |
diff --git a/multipath/main.c b/multipath/main.c
|
|
|
785c99 |
index a2080029..612c6815 100644
|
|
|
785c99 |
--- a/multipath/main.c
|
|
|
785c99 |
+++ b/multipath/main.c
|
|
|
785c99 |
@@ -828,6 +828,20 @@ int delegate_to_multipathd(enum mpath_cmds cmd,
|
|
|
785c99 |
if (cmd == CMD_CREATE && conf->force_reload == FORCE_RELOAD_YES) {
|
|
|
785c99 |
p += snprintf(p, n, "reconfigure");
|
|
|
785c99 |
}
|
|
|
785c99 |
+ else if (cmd == CMD_FLUSH_ONE && dev && dev_type == DEV_DEVMAP) {
|
|
|
785c99 |
+ p += snprintf(p, n, "del map %s", dev);
|
|
|
785c99 |
+ /* multipathd doesn't try as hard, to avoid potentially
|
|
|
785c99 |
+ * hanging. If it fails, retry with the regular multipath
|
|
|
785c99 |
+ * command */
|
|
|
785c99 |
+ r = NOT_DELEGATED;
|
|
|
785c99 |
+ }
|
|
|
785c99 |
+ else if (cmd == CMD_FLUSH_ALL) {
|
|
|
785c99 |
+ p += snprintf(p, n, "del maps");
|
|
|
785c99 |
+ /* multipathd doesn't try as hard, to avoid potentially
|
|
|
785c99 |
+ * hanging. If it fails, retry with the regular multipath
|
|
|
785c99 |
+ * command */
|
|
|
785c99 |
+ r = NOT_DELEGATED;
|
|
|
785c99 |
+ }
|
|
|
785c99 |
/* Add other translations here */
|
|
|
785c99 |
|
|
|
785c99 |
if (strlen(command) == 0)
|
|
|
785c99 |
diff --git a/multipath/multipath.8 b/multipath/multipath.8
|
|
|
785c99 |
index 8befc45a..47a33f9b 100644
|
|
|
785c99 |
--- a/multipath/multipath.8
|
|
|
785c99 |
+++ b/multipath/multipath.8
|
|
|
785c99 |
@@ -125,11 +125,11 @@ the system.
|
|
|
785c99 |
Other operation modes are chosen by using one of the following command line switches:
|
|
|
785c99 |
.TP
|
|
|
785c99 |
.B \-f
|
|
|
785c99 |
-Flush (remove) a multipath device map specified as parameter, if unused.
|
|
|
785c99 |
+Flush (remove) a multipath device map specified as parameter, if unused. This operation is delegated to the multipathd daemon if it's running.
|
|
|
785c99 |
.
|
|
|
785c99 |
.TP
|
|
|
785c99 |
.B \-F
|
|
|
785c99 |
-Flush (remove) all unused multipath device maps.
|
|
|
785c99 |
+Flush (remove) all unused multipath device maps. This operation is delegated to the multipathd daemon if it's running.
|
|
|
785c99 |
.
|
|
|
785c99 |
.TP
|
|
|
785c99 |
.B \-l
|
|
|
785c99 |
--
|
|
|
785c99 |
2.17.2
|
|
|
785c99 |
|