On Mon, Mar 14, 2022 at 10:30:32PM +0100, mwi...@suse.com wrote:
> From: Martin Wilck <mwi...@suse.com>

Reviewed-by: Benjamin Marzinski <bmarz...@redhat.com>

> 
> No need to test for state == DAEMON_CONFIGURE at this point, we
> know that this is the case.
> 
> Signed-off-by: Martin Wilck <mwi...@suse.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
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel

Reply via email to