[dm-devel] [PATCH v2 01/11] multipathd: child(): remove superfluous if condition

Benjamin Marzinski bmarzins at redhat.com
Tue Mar 22 00:18:34 UTC 2022


On Fri, Mar 18, 2022 at 5:33 PM <mwilck at suse.com> wrote:
>
> From: Martin Wilck <mwilck at suse.com>
>
> No need to test for state == DAEMON_CONFIGURE at this point, we
> know that this is the case.
>
> Signed-off-by: Martin Wilck <mwilck at suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
> ---
>  multipathd/main.c | 32 ++++++++++++++++----------------
>  1 file changed, 16 insertions(+), 16 deletions(-)
>
> diff --git a/multipathd/main.c b/multipathd/main.c
> index f2c0b28..1c8839d 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -3395,6 +3395,8 @@ child (__attribute__((unused)) void *param)
>         pthread_attr_destroy(&misc_attr);
>
>         while (1) {
> +               int rc = 0;
> +
>                 pthread_cleanup_push(config_cleanup, NULL);
>                 pthread_mutex_lock(&config_lock);
>                 while (running_state != DAEMON_CONFIGURE &&
> @@ -3404,23 +3406,21 @@ child (__attribute__((unused)) void *param)
>                 pthread_cleanup_pop(1);
>                 if (state == DAEMON_SHUTDOWN)
>                         break;
> -               if (state == DAEMON_CONFIGURE) {
> -                       int rc = 0;
>
> -                       pthread_cleanup_push(cleanup_lock, &vecs->lock);
> -                       lock(&vecs->lock);
> -                       pthread_testcancel();
> -                       if (!need_to_delay_reconfig(vecs))
> -                               rc = reconfigure(vecs);
> -                       else
> -                               enable_delayed_reconfig();
> -                       lock_cleanup_pop(vecs->lock);
> -                       if (!rc)
> -                               post_config_state(DAEMON_IDLE);
> -                       else {
> -                               condlog(0, "fatal error applying configuration - aborting");
> -                               exit_daemon();
> -                       }
> +               /* handle DAEMON_CONFIGURE */
> +               pthread_cleanup_push(cleanup_lock, &vecs->lock);
> +               lock(&vecs->lock);
> +               pthread_testcancel();
> +               if (!need_to_delay_reconfig(vecs))
> +                       rc = reconfigure(vecs);
> +               else
> +                       enable_delayed_reconfig();
> +               lock_cleanup_pop(vecs->lock);
> +               if (!rc)
> +                       post_config_state(DAEMON_IDLE);
> +               else {
> +                       condlog(0, "fatal error applying configuration - aborting");
> +                       exit_daemon();
>                 }
>         }
>
> --
> 2.35.1
>



More information about the dm-devel mailing list