We now have the possibility to run several PR commands in a single mpathpersist invocation. Run initialization / discovery and teardown only once at program invocation / exit. Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> --- mpathpersist/main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mpathpersist/main.c b/mpathpersist/main.c index 6df9762d..cbb59623 100644 --- a/mpathpersist/main.c +++ b/mpathpersist/main.c @@ -374,6 +374,9 @@ static int handle_args(int argc, char * argv[], int nline) /* set verbosity */ noisy = (loglevel >= 3) ? 1 : hex; verbose = (loglevel >= 3)? 3: loglevel; + ret = mpath_persistent_reserve_init_vecs(verbose); + if (ret != MPATH_PR_SUCCESS) + goto out; } if ((prout_flag + prin_flag) == 0 && batch_fn == NULL) @@ -480,7 +483,7 @@ static int handle_args(int argc, char * argv[], int nline) goto out; } - ret = mpath_persistent_reserve_in (fd, prin_sa, resp, noisy, verbose); + ret = __mpath_persistent_reserve_in (fd, prin_sa, resp, noisy); if (ret != MPATH_PR_SUCCESS ) { fprintf (stderr, "Persistent Reserve IN command failed\n"); @@ -540,8 +543,8 @@ static int handle_args(int argc, char * argv[], int nline) } /* PROUT commands other than 'register and move' */ - ret = mpath_persistent_reserve_out (fd, prout_sa, 0, prout_type, - paramp, noisy, verbose); + ret = __mpath_persistent_reserve_out (fd, prout_sa, 0, prout_type, + paramp, noisy); for (j = 0 ; j < num_transport; j++) { tmp = paramp->trnptid_list[j]; @@ -580,6 +583,8 @@ out : free(batch_fn); ret = ret == 0 ? rv : ret; } + if (nline == 0) + mpath_persistent_reserve_free_vecs(); return (ret >= 0) ? ret : MPATH_PR_OTHER; } -- 2.21.0 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel