[dm-devel] [PATCH 6/9] multipathd: drop lock before calling uev_add_path

Alban Browaeys prahal at yahoo.com
Fri Apr 7 13:23:11 UTC 2017


Le vendredi 07 avril 2017 à 01:16 -0500, Benjamin Marzinski a écrit :
> commit c6a18f4541d0a161e2f5fed8c67d9732bf512b37 made uev_update_path
> call uev_add_path while holding the vecs lock, which is deadlocks,
> since
> uev_add_path grabs the vecs lock itself.
> 
> Cc: Alban Browaeys <prahal at yahoo.com>
> Signed-off-by: Benjamin Marzinski <bmarzins at redhat.com>
> ---
>  multipathd/main.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/multipathd/main.c b/multipathd/main.c
> index f671d58..f4ff13e 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -974,6 +974,7 @@ uev_update_path (struct uevent *uev, struct
> vectors * vecs)
>  	struct path * pp;
>  	struct config *conf;
>  	int disable_changed_wwids;
> +	int needs_reinit = 0;
>  
>  	conf = get_multipath_config();
>  	disable_changed_wwids = conf->disable_changed_wwids;
> @@ -1009,7 +1010,7 @@ uev_update_path (struct uevent *uev, struct
> vectors * vecs)
>  		}
>  
>  		if (pp->initialized == INIT_REQUESTED_UDEV)
> -			retval = uev_add_path(uev, vecs, 1);
> +			needs_reinit = 1;
>  		else if (mpp && ro >= 0) {
>  			condlog(2, "%s: update path write_protect to
> '%d' (uevent)", uev->kernel, ro);
>  
> @@ -1041,7 +1042,8 @@ out:
>  
>  		condlog(0, "%s: spurious uevent, path not found",
> uev->kernel);
>  	}
> -
> +	if (needs_reinit)
> +		retval = uev_add_path(uev, vecs, 1);
>  	return retval;
>  }


Thanks a lot. 
The patch fixes the hang in multipathd.
I made a minor modification for the test as I test above multipath-
tools 0.6.4. 
I stripped the need_do_map parameter from uev_add_path.

Thanks
Alban




More information about the dm-devel mailing list