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

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