[dm-devel] dm-multipath [PATCH] multipathd adding devices.

Christophe Varoqui christophe.varoqui at free.fr
Thu Mar 2 11:09:31 UTC 2006


On Fri, Feb 24, 2006 at 08:33:29PM -0600, Benjamin Marzinski wrote:
> The way multipathd currently works, if you add a map that isn't known to
> device mapper from multipathd, the first time you run the command, it won't
> add the map to the mpvec vector.  With the attached patch, multipathd will
> initialize the map and add it to the mpvec vector.
> 
How does the current behaviour affects you ?
Is this about races between DM and netlink events ?

Regards,
cvaroqui

> diff -urpN mp-devel-clean/multipathd/main.c mp-devel-patched/multipathd/main.c
> --- mp-devel-clean/multipathd/main.c	2006-02-23 17:33:58.000000000 -0600
> +++ mp-devel-patched/multipathd/main.c	2006-02-24 21:16:17.000000000 -0600
> @@ -550,6 +550,7 @@ ev_add_map (char * devname, struct vecto
>  	char * alias;
>  	char * refwwid;
>  	struct multipath * mpp;
> +	vector mpvec;
>  	int map_present;
>  	int r = 1;
>  
> @@ -597,10 +598,33 @@ ev_add_map (char * devname, struct vecto
>  	refwwid = get_refwwid(devname, DEV_DEVMAP, vecs->pathvec);
>  
>  	if (refwwid) {
> -		r = coalesce_paths(vecs, NULL, refwwid);
> +		int i;
> +		if (!(mpvec = vector_alloc()))
> +			goto out;
> +		r = coalesce_paths(vecs, mpvec, refwwid);
>  		dm_lib_release();
> +		if (r)
> +			goto out_free;
> +		r = 1;
> +		vector_foreach_slot(mpvec, mpp, i){
> +			if (!vector_alloc_slot(vecs->mpvec)) {
> +				orphan_paths(vecs->pathvec, mpp);
> +				free_multipath(mpp, KEEP_PATHS);
> +				goto out_free;
> +			}
> +			vector_set_slot(vecs->mpvec, mpp);
> +			sync_map_state(mpp);
> +			if (setup_multipath(vecs, mpp))
> +				goto out_free;
> +			if (start_waiter_thread(mpp, vecs))
> +				goto out_free;
> +			r = 0;
> +		}
>  	}
>  	
> +out_free:
> +	vector_free(mpvec);
> +out:
>  	if (!r)
>  		condlog(3, "%s: devmap %s added", alias, devname);
>  	else

> --
> dm-devel mailing list
> dm-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel




More information about the dm-devel mailing list