Blame SOURCES/0029-multipath-delegate-flushing-maps-to-multipathd.patch

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