diff mbox series

[v2,7/8] multipathd: unset mpp->hwe when removing map

Message ID 1597183123-15797-8-git-send-email-bmarzins@redhat.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath cleanups | expand

Commit Message

Benjamin Marzinski Aug. 11, 2020, 9:58 p.m. UTC
If the map doesn't unset its hwe pointer before orphaning all the paths,
multipathd will print a warning message in orphan_path() because of
commit "libmultipath: warn if freeing path that holds mpp->hwe".

Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
 libmultipath/structs_vec.c | 1 +
 multipathd/main.c          | 1 +
 2 files changed, 2 insertions(+)

Comments

Martin Wilck Aug. 12, 2020, 9:28 a.m. UTC | #1
On Tue, 2020-08-11 at 16:58 -0500, Benjamin Marzinski wrote:
> If the map doesn't unset its hwe pointer before orphaning all the
> paths,
> multipathd will print a warning message in orphan_path() because of
> commit "libmultipath: warn if freeing path that holds mpp->hwe".
> 
> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>

Do you have a specific reason to put "mpp->hwe = NULL" in the *callers*
of orphan_paths()? I observed the same problem, and fixed it
directly in orphan_paths() (the patch is part of in my upcoming v2
series).

Regards,
Martin


> ---
>  libmultipath/structs_vec.c | 1 +
>  multipathd/main.c          | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
> index ede14297..103ea11e 100644
> --- a/libmultipath/structs_vec.c
> +++ b/libmultipath/structs_vec.c
> @@ -129,6 +129,7 @@ remove_map(struct multipath * mpp, struct vectors
> * vecs, int purge_vec)
>  	/*
>  	 * clear references to this map
>  	 */
> +	mpp->hwe = NULL;
>  	orphan_paths(vecs->pathvec, mpp, "map removed internally");
>  
>  	if (purge_vec &&
> diff --git a/multipathd/main.c b/multipathd/main.c
> index f014d2a1..2b0e2734 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -666,6 +666,7 @@ flush_map(struct multipath * mpp, struct vectors
> * vecs, int nopaths)
>  		condlog(2, "%s: map flushed", mpp->alias);
>  	}
>  
> +	mpp->hwe = NULL;
>  	orphan_paths(vecs->pathvec, mpp, "map flushed");
>  	remove_map_and_stop_waiter(mpp, vecs);
>
Benjamin Marzinski Aug. 12, 2020, 4:07 p.m. UTC | #2
On Wed, Aug 12, 2020 at 09:28:14AM +0000, Martin Wilck wrote:
> On Tue, 2020-08-11 at 16:58 -0500, Benjamin Marzinski wrote:
> > If the map doesn't unset its hwe pointer before orphaning all the
> > paths,
> > multipathd will print a warning message in orphan_path() because of
> > commit "libmultipath: warn if freeing path that holds mpp->hwe".
> > 
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> 
> Do you have a specific reason to put "mpp->hwe = NULL" in the *callers*
> of orphan_paths()?

Nope.

> I observed the same problem, and fixed it
> directly in orphan_paths() (the patch is part of in my upcoming v2
> series).

we can go with yours then.

-Ben

> Regards,
> Martin
> 
> 
> > ---
> >  libmultipath/structs_vec.c | 1 +
> >  multipathd/main.c          | 1 +
> >  2 files changed, 2 insertions(+)
> > 
> > diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
> > index ede14297..103ea11e 100644
> > --- a/libmultipath/structs_vec.c
> > +++ b/libmultipath/structs_vec.c
> > @@ -129,6 +129,7 @@ remove_map(struct multipath * mpp, struct vectors
> > * vecs, int purge_vec)
> >  	/*
> >  	 * clear references to this map
> >  	 */
> > +	mpp->hwe = NULL;
> >  	orphan_paths(vecs->pathvec, mpp, "map removed internally");
> >  
> >  	if (purge_vec &&
> > diff --git a/multipathd/main.c b/multipathd/main.c
> > index f014d2a1..2b0e2734 100644
> > --- a/multipathd/main.c
> > +++ b/multipathd/main.c
> > @@ -666,6 +666,7 @@ flush_map(struct multipath * mpp, struct vectors
> > * vecs, int nopaths)
> >  		condlog(2, "%s: map flushed", mpp->alias);
> >  	}
> >  
> > +	mpp->hwe = NULL;
> >  	orphan_paths(vecs->pathvec, mpp, "map flushed");
> >  	remove_map_and_stop_waiter(mpp, vecs);
> >  
> 
> -- 
> Dr. Martin Wilck <mwilck@suse.com>, Tel. +49 (0)911 74053 2107
> SUSE  Software Solutions Germany GmbH
> HRB 36809, AG Nürnberg GF: Felix
> Imendörffer
> 

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index ede14297..103ea11e 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -129,6 +129,7 @@  remove_map(struct multipath * mpp, struct vectors * vecs, int purge_vec)
 	/*
 	 * clear references to this map
 	 */
+	mpp->hwe = NULL;
 	orphan_paths(vecs->pathvec, mpp, "map removed internally");
 
 	if (purge_vec &&
diff --git a/multipathd/main.c b/multipathd/main.c
index f014d2a1..2b0e2734 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -666,6 +666,7 @@  flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
 		condlog(2, "%s: map flushed", mpp->alias);
 	}
 
+	mpp->hwe = NULL;
 	orphan_paths(vecs->pathvec, mpp, "map flushed");
 	remove_map_and_stop_waiter(mpp, vecs);