2b0cd7cceb
Rebased on top of Martin Wilck's queue of ACKed upstream commits * https://github.com/openSUSE/multipath-tools/tree/upstream-queue * All previous patches have been reordered, with the exception of 0011-libdmmp-Add-support-for-upcoming-json-c-0.14.0.patch which has been replaced with 0029-fix-boolean-value-with-json-c-0.14.patch Modify 0054-RH-add-mpathconf.patch * remove default enable_foreign and property blacklist_exceptions settings, and deal with the builtin default change from 0031-libmultipath-set-enable_foreign-to-NONE-by-default.patch. Fixes bz #1853668 Add 0048-Makefile.inc-trim-extra-information-from-systemd-ver.patch Add 0049-kpartx-fix-Wsign-compare-error.patch * The above two patches have been submitted upstream
105 lines
2.8 KiB
Diff
105 lines
2.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Thu, 2 Jul 2020 19:07:04 -0500
|
|
Subject: [PATCH] multipath: make flushing maps work like other commands
|
|
|
|
The config structure doesn't need a special variable just for removes.
|
|
Multipath can just use the cmd variable, like it does for the other
|
|
commands.
|
|
|
|
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
libmultipath/config.h | 3 ++-
|
|
libmultipath/configure.h | 3 ---
|
|
multipath/main.c | 20 ++++++++++----------
|
|
3 files changed, 12 insertions(+), 14 deletions(-)
|
|
|
|
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
|
index ceecff2d..55569360 100644
|
|
--- a/libmultipath/config.h
|
|
+++ b/libmultipath/config.h
|
|
@@ -38,6 +38,8 @@ enum mpath_cmds {
|
|
CMD_ADD_WWID,
|
|
CMD_USABLE_PATHS,
|
|
CMD_DUMP_CONFIG,
|
|
+ CMD_FLUSH_ONE,
|
|
+ CMD_FLUSH_ALL,
|
|
};
|
|
|
|
enum force_reload_types {
|
|
@@ -142,7 +144,6 @@ struct config {
|
|
unsigned int max_checkint;
|
|
bool use_watchdog;
|
|
int pgfailback;
|
|
- int remove;
|
|
int rr_weight;
|
|
int no_path_retry;
|
|
int user_friendly_names;
|
|
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
|
|
index d7509000..0e33bf40 100644
|
|
--- a/libmultipath/configure.h
|
|
+++ b/libmultipath/configure.h
|
|
@@ -45,9 +45,6 @@ enum {
|
|
CP_RETRY,
|
|
};
|
|
|
|
-#define FLUSH_ONE 1
|
|
-#define FLUSH_ALL 2
|
|
-
|
|
struct vectors;
|
|
|
|
int setup_map (struct multipath * mpp, char * params, int params_size,
|
|
diff --git a/multipath/main.c b/multipath/main.c
|
|
index d89f0a91..101fd656 100644
|
|
--- a/multipath/main.c
|
|
+++ b/multipath/main.c
|
|
@@ -909,10 +909,10 @@ main (int argc, char *argv[])
|
|
cmd = CMD_DRY_RUN;
|
|
break;
|
|
case 'f':
|
|
- conf->remove = FLUSH_ONE;
|
|
+ cmd = CMD_FLUSH_ONE;
|
|
break;
|
|
case 'F':
|
|
- conf->remove = FLUSH_ALL;
|
|
+ cmd = CMD_FLUSH_ALL;
|
|
break;
|
|
case 'l':
|
|
if (optarg && !strncmp(optarg, "l", 1))
|
|
@@ -1053,6 +1053,10 @@ main (int argc, char *argv[])
|
|
condlog(0, "the -w option requires a device");
|
|
goto out;
|
|
}
|
|
+ if (cmd == CMD_FLUSH_ONE && dev_type != DEV_DEVMAP) {
|
|
+ condlog(0, "the -f option requires a map name to remove");
|
|
+ goto out;
|
|
+ }
|
|
|
|
switch(delegate_to_multipathd(cmd, dev, dev_type, conf)) {
|
|
case DELEGATE_OK:
|
|
@@ -1086,16 +1090,12 @@ main (int argc, char *argv[])
|
|
}
|
|
if (retries < 0)
|
|
retries = conf->remove_retries;
|
|
- if (conf->remove == FLUSH_ONE) {
|
|
- if (dev_type == DEV_DEVMAP) {
|
|
- r = dm_suspend_and_flush_map(dev, retries) ?
|
|
- RTVL_FAIL : RTVL_OK;
|
|
- } else
|
|
- condlog(0, "must provide a map name to remove");
|
|
-
|
|
+ if (cmd == CMD_FLUSH_ONE) {
|
|
+ r = dm_suspend_and_flush_map(dev, retries) ?
|
|
+ RTVL_FAIL : RTVL_OK;
|
|
goto out;
|
|
}
|
|
- else if (conf->remove == FLUSH_ALL) {
|
|
+ else if (cmd == CMD_FLUSH_ALL) {
|
|
r = dm_flush_maps(1, retries) ? RTVL_FAIL : RTVL_OK;
|
|
goto out;
|
|
}
|
|
--
|
|
2.17.2
|
|
|