Skip to content

Commit

Permalink
multipath: do not change configuration when dumpping config
Browse files Browse the repository at this point in the history
"multipath -t" and "multipath -T" might change multipathd
configuration items "retrigger_tries" and "force_sync".
Make sure they don't.

Signed-off-by: Kou Wenqi <kouwenqi@kylinos.cn>
  • Loading branch information
Kou Wenqi committed Jun 21, 2024
1 parent efa6a26 commit 53cce61
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions multipath/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,8 @@ main (int argc, char *argv[])
char *dev = NULL;
struct config *conf;
bool enable_foreign = false;
int retrigger_tries_ori;
int force_sync_ori;

libmultipath_init();
if (atexit(dm_lib_exit) || atexit(libmultipath_exit))
Expand All @@ -852,7 +854,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;
if (atexit(cleanup_vecs))
condlog(1, "failed to register cleanup handler for vecs: %m");
Expand Down Expand Up @@ -924,10 +928,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]);
Expand Down

0 comments on commit 53cce61

Please sign in to comment.