multipath: display the correct configuration when dumpping config

"multipath -t" and "multipath -T" might show the wrong
multipathd configuration items "retrigger_tries" and
"force_sync". Make sure they don't.

(cherry picked from commit df7cdf4f6eba3ba27093a67bad278a9ec173899f)
This commit is contained in:
Kou Wenqi 2024-08-05 14:15:47 +08:00 committed by openeuler-sync-bot
parent b5450f6239
commit fbfe7731b9
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From 16108e00550991bec70391a4e51a13dceb847300 Mon Sep 17 00:00:00 2001
From: Kou Wenqi <kouwenqi@kylinos.cn>
Date: Mon, 5 Aug 2024 14:12:50 +0800
Subject: [PATCH] multipath: display the correct configuration when dumpping
config
"multipath -t" and "multipath -T" might show the wrong
multipathd configuration items "retrigger_tries" and
"force_sync". Make sure they don't.
---
multipath/main.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/multipath/main.c b/multipath/main.c
index e964792..2ab302f 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -826,6 +826,8 @@ main (int argc, char *argv[])
struct config *conf;
int retries = -1;
bool enable_foreign = false;
+ int retrigger_tries_ori;
+ int force_sync_ori;
libmultipath_init();
if (atexit(dm_lib_exit) || atexit(libmultipath_exit))
@@ -836,7 +838,9 @@ main (int argc, char *argv[])
if (atexit(uninit_config))
condlog(1, "failed to register cleanup handler for config: %m");
conf = get_multipath_config();
+ retrigger_tries_ori = conf->retrigger_tries;
conf->retrigger_tries = 0;
+ force_sync_ori = conf->force_sync;
conf->force_sync = 1;
atexit(cleanup_vecs);
while ((arg = getopt(argc, argv, ":adDcChl::eFfM:v:p:b:BrR:itTquUwW")) != EOF ) {
@@ -911,10 +915,14 @@ main (int argc, char *argv[])
conf->find_multipaths = FIND_MULTIPATHS_GREEDY;
break;
case 't':
+ conf->retrigger_tries = retrigger_tries_ori;
+ conf->force_sync = force_sync_ori;
r = dump_config(conf, NULL, NULL) ? RTVL_FAIL : RTVL_OK;
goto out;
case 'T':
cmd = CMD_DUMP_CONFIG;
+ conf->retrigger_tries = retrigger_tries_ori;
+ conf->force_sync = force_sync_ori;
break;
case 'h':
usage(argv[0]);
--
2.27.0

View File

@ -1,7 +1,7 @@
#needsrootforbuild
Name: multipath-tools
Version: 0.8.7
Release: 14
Release: 15
Summary: Tools to manage multipath devices with the device-mapper
License: GPL-2.0-or-later and LGPL-2.0-only
URL: http://christophe.varoqui.free.fr/
@ -40,6 +40,7 @@ Patch28: 0028-multipathd.socket-add-missing-conditions-from-servic.patch
Patch29: 0029-libmultipath-sysfs_set_scsi_tmo-do-nothing-for-ACT_D.patch
Patch30: 0030-multipath.conf.5-fix-documentation-for-find_multipat.patch
Patch31: 0031-multipath.conf.5-fix-the-description-of-prio_args-fo.patch
Patch32: 0032-multipath-display-the-correct-configuration-when-dum.patch
BuildRequires: multipath-tools, libcmocka, libcmocka-devel
BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89
@ -187,6 +188,9 @@ fi
%changelog
* Mon Aug 5 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.7-15
- multipath: display the correct configuration when dumpping config
* Fri Aug 2 2024 kouwenqi <kouwenqi@kylinos.cn> - 0.8.7-14
- multipath.conf.5: fix the description of prio_args for path_latency prio