Re: [PATCH 1/5] multipathd: child(): remove superfluous if condition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 14, 2022 at 10:30:32PM +0100, mwilck@xxxxxxxx wrote:
> From: Martin Wilck <mwilck@xxxxxxxx>

Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>

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




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux