All of lore.kernel.org
 help / color / mirror / Atom feed
* dm-multipath [PATCH] multipathd adding devices.
@ 2006-02-25  2:33 Benjamin Marzinski
  2006-03-02 11:09 ` Christophe Varoqui
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Marzinski @ 2006-02-25  2:33 UTC (permalink / raw)
  To: dm-devel

[-- Attachment #1: Type: text/plain, Size: 281 bytes --]

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.

-Ben

[-- Attachment #2: add_map.patch --]
[-- Type: text/plain, Size: 1246 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dm-multipath [PATCH] multipathd adding devices.
  2006-02-25  2:33 dm-multipath [PATCH] multipathd adding devices Benjamin Marzinski
@ 2006-03-02 11:09 ` Christophe Varoqui
  2006-03-02 15:41   ` Christophe Varoqui
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Varoqui @ 2006-03-02 11:09 UTC (permalink / raw)
  To: device-mapper development

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@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dm-multipath [PATCH] multipathd adding devices.
  2006-03-02 11:09 ` Christophe Varoqui
@ 2006-03-02 15:41   ` Christophe Varoqui
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe Varoqui @ 2006-03-02 15:41 UTC (permalink / raw)
  To: device-mapper development

On Thu, Mar 02, 2006 at 12:09:31PM +0100, Christophe Varoqui wrote:
> 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 ?
> 
To be more specific, I think the current code rely on the netlink "map add" event triggered by coalesce_paths() to feed the mpvec asynchronously.

... which seems ok to me, but I may miss a point.

Regards,
cvaroqui

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: dm-multipath [PATCH] multipathd adding devices.
@ 2006-03-02 16:28 egoggin
  2006-03-02 16:38 ` Christophe Varoqui
  0 siblings, 1 reply; 5+ messages in thread
From: egoggin @ 2006-03-02 16:28 UTC (permalink / raw)
  To: dm-devel

On Thu, Mar 02, 2006 at 12:09:31PM +0100, Christophe Varoqui wrote:
> > 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 ?
> > 
> To be more specific, I think the current code rely on the 
> netlink "map add" event triggered by coalesce_paths() to feed 
> the mpvec asynchronously.
> 
> ... which seems ok to me, but I may miss a point.

What is the "current" code, the code in the git repository or
the latest release point multipath-tools-0.4.6.1?  This certainly
works fine in the code from the git repository.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: dm-multipath [PATCH] multipathd adding devices.
  2006-03-02 16:28 egoggin
@ 2006-03-02 16:38 ` Christophe Varoqui
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe Varoqui @ 2006-03-02 16:38 UTC (permalink / raw)
  To: device-mapper development

On Thu, Mar 02, 2006 at 11:28:04AM -0500, egoggin@emc.com wrote:
> On Thu, Mar 02, 2006 at 12:09:31PM +0100, Christophe Varoqui wrote:
> > > 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 ?
> > > 
> > To be more specific, I think the current code rely on the 
> > netlink "map add" event triggered by coalesce_paths() to feed 
> > the mpvec asynchronously.
> > 
> > ... which seems ok to me, but I may miss a point.
> 
> What is the "current" code, the code in the git repository or
> the latest release point multipath-tools-0.4.6.1?  This certainly
> works fine in the code from the git repository.
> 
I was refering to the git HEAD.

Regards,
cvaroqui

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-03-02 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-25  2:33 dm-multipath [PATCH] multipathd adding devices Benjamin Marzinski
2006-03-02 11:09 ` Christophe Varoqui
2006-03-02 15:41   ` Christophe Varoqui
  -- strict thread matches above, loose matches on Subject: below --
2006-03-02 16:28 egoggin
2006-03-02 16:38 ` Christophe Varoqui

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.