On Thu, Aug 18, 2022 at 11:06:30PM +0200, mwi...@suse.com wrote:
> From: Martin Wilck <mwi...@suse.com>
> 
> Neither "multipath -u" nor "multipath -U" need initialization of the
> prioritizers, checkers, and foreign libraries. Also, these commands
> need not fail if the bindings file is inconsistent. Move these
> possibly slow initialization steps after these special command
> invocations.
> 
> Signed-off-by: Martin Wilck <mwi...@suse.com>
Reviewed-by: Benjamin Marzinski <bmarz...@redhat.com>
> ---
>  multipath/main.c | 33 +++++++++++++++++----------------
>  1 file changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/multipath/main.c b/multipath/main.c
> index 034dd2f..8e5154a 100644
> --- a/multipath/main.c
> +++ b/multipath/main.c
> @@ -957,11 +957,6 @@ main (int argc, char *argv[])
>               exit(RTVL_FAIL);
>       }
>  
> -     if (check_alias_settings(conf)) {
> -             fprintf(stderr, "fatal configuration error, aborting");
> -             exit(RTVL_FAIL);
> -     }
> -
>       if (optind < argc) {
>               dev = calloc(1, FILE_NAME_SIZE);
>  
> @@ -988,20 +983,9 @@ main (int argc, char *argv[])
>  
>       libmp_udev_set_sync_support(1);
>  
> -     if (init_checkers()) {
> -             condlog(0, "failed to initialize checkers");
> -             goto out;
> -     }
> -     if (init_prio()) {
> -             condlog(0, "failed to initialize prioritizers");
> -             goto out;
> -     }
> -
>       if ((cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG) && enable_foreign)
>               conf->enable_foreign = strdup("");
>  
> -     /* Failing here is non-fatal */
> -     init_foreign(conf->enable_foreign);
>       if (cmd == CMD_USABLE_PATHS) {
>               r = check_usable_paths(conf, dev, dev_type) ?
>                       RTVL_FAIL : RTVL_OK;
> @@ -1036,6 +1020,23 @@ main (int argc, char *argv[])
>               break;
>       }
>  
> +     if (check_alias_settings(conf)) {
> +             fprintf(stderr, "fatal configuration error, aborting");
> +             exit(RTVL_FAIL);
> +     }
> +
> +     if (init_checkers()) {
> +             condlog(0, "failed to initialize checkers");
> +             goto out;
> +     }
> +     if (init_prio()) {
> +             condlog(0, "failed to initialize prioritizers");
> +             goto out;
> +     }
> +
> +     /* Failing here is non-fatal */
> +     init_foreign(conf->enable_foreign);
> +
>       if (cmd == CMD_RESET_WWIDS) {
>               struct multipath * mpp;
>               int i;
> -- 
> 2.37.1
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to