All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Marzinski <bmarzins@redhat.com>
To: Martin Wilck <martin.wilck@suse.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>,
	device-mapper development <dm-devel@lists.linux.dev>
Subject: Re: [PATCH 13/22] multipathd: resync map after setup_map in ev_remove_path
Date: Tue, 16 Jul 2024 11:15:38 -0400	[thread overview]
Message-ID: <ZpaOmhu2y-AoEZHB@redhat.com> (raw)
In-Reply-To: <5b52909bfeca226b6713f0be1730a1f7026a67ad.camel@suse.com>

On Mon, Jul 15, 2024 at 06:32:22PM +0200, Martin Wilck wrote:
> On Sat, 2024-07-13 at 02:04 -0400, Benjamin Marzinski wrote:
> > In ev_remove_path() it was possible to exit after calling setup_map()
> > without resyncing the mpp state with the kernel. This meant that the
> > mpp state in multipathd might not match with the kernel state at all.
> > 
> > It's safe to exit before calling setup_map() if either wait_for_udev
> > or need_do_map is set. In both cases, setup_map() will later be
> > called,
> > either by a uevent or by the calling function.
> > 
> > Once setup_map() has been called, setup_multipath() and
> > sync_map_state()
> > are now always called, to make sure the mpp matches the kernel state.
> > 
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > ---
> >  multipathd/main.c | 40 +++++++++++++++++++---------------------
> >  1 file changed, 19 insertions(+), 21 deletions(-)
> > 
> > diff --git a/multipathd/main.c b/multipathd/main.c
> > index 179fec24..3c84c2a0 100644
> > --- a/multipathd/main.c
> > +++ b/multipathd/main.c
> > @@ -1395,6 +1395,8 @@ ev_remove_path (struct path *pp, struct vectors
> > * vecs, int need_do_map)
> >  	 * avoid referring to the map of an orphaned path
> >  	 */
> >  	if ((mpp = pp->mpp)) {
> > +		char devt[BLK_DEV_SIZE];
> > +
> >  		/*
> >  		 * Mark the path as removed. In case of success, we
> >  		 * will delete it for good. Otherwise, it will be
> > deleted
> > @@ -1428,12 +1430,6 @@ ev_remove_path (struct path *pp, struct
> > vectors * vecs, int need_do_map)
> >  		    flush_map_nopaths(mpp, vecs))
> >  			goto out;
> >  
> > -		if (setup_map(mpp, &params, vecs)) {
> > -			condlog(0, "%s: failed to setup map for"
> > -				" removal of path %s", mpp->alias,
> > pp->dev);
> > -			goto fail;
> > -		}
> > -
> >  		if (mpp->wait_for_udev) {
> >  			mpp->wait_for_udev = 2;
> >  			retval = REMOVE_PATH_DELAY;
> > @@ -1444,33 +1440,35 @@ ev_remove_path (struct path *pp, struct
> > vectors * vecs, int need_do_map)
> >  			retval = REMOVE_PATH_DELAY;
> >  			goto out;
> >  		}
> > +
> > +		if (setup_map(mpp, &params, vecs)) {
> > +			condlog(0, "%s: failed to setup map for"
> > +				" removal of path %s", mpp->alias,
> > pp->dev);
> > +			goto fail;
> > +		}
> >  		/*
> >  		 * reload the map
> >  		 */
> >  		mpp->action = ACT_RELOAD;
> > +		strlcpy(devt, pp->dev_t, sizeof(devt));
> 
> Move this statement further down, directly before the call to
> setup_multipath(), perhaps? It's only for the condlog anyway.
> 

Sure.

> Except for that, LGTM.
> 
> Martin
> 
> 
> >  		if (domap(mpp, params, 1) == DOMAP_FAIL) {
> >  			condlog(0, "%s: failed in domap for "
> >  				"removal of path %s",
> >  				mpp->alias, pp->dev);
> >  			retval = REMOVE_PATH_FAILURE;
> > -		} else {
> > -			/*
> > -			 * update our state from kernel
> > -			 */
> > -			char devt[BLK_DEV_SIZE];
> > -
> > -			strlcpy(devt, pp->dev_t, sizeof(devt));
> > -
> > -			/* setup_multipath will free the path
> > -			 * regardless of whether it succeeds or
> > -			 * fails */
> > -			if (setup_multipath(vecs, mpp))
> > -				return REMOVE_PATH_MAP_ERROR;
> > -			sync_map_state(mpp);
> > +		}
> > +		/*
> > +		 * update mpp state from kernel even if domap
> > failed.
> > +		 * If the path was removed from the mpp,
> > setup_multipath will
> > +		 * free the path regardless of whether it succeeds
> > or fails
> > +		 */
> > +		if (setup_multipath(vecs, mpp))
> > +			return REMOVE_PATH_MAP_ERROR;
> > +		sync_map_state(mpp);
> >  
> > +		if (retval == REMOVE_PATH_SUCCESS)
> >  			condlog(2, "%s: path removed from map %s",
> >  				devt, mpp->alias);
> > -		}
> >  	} else {
> >  		/* mpp == NULL */
> >  		if ((i = find_slot(vecs->pathvec, (void *)pp)) != -
> > 1)


  reply	other threads:[~2024-07-16 15:15 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-13  6:04 [PATCH 00/22] path checker refactor and misc fixes Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 01/22] libmultipath: rename dm_map_present_by_wwid() and add outputs Benjamin Marzinski
2024-07-15 10:53   ` Martin Wilck
2024-07-15 15:51     ` Martin Wilck
2024-07-15 15:14   ` Martin Wilck
2024-07-16 14:22     ` Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 02/22] multipathd: make cli_add_map() handle adding maps by WWID correctly Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 03/22] multipathd: remove checker restart optimization Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 04/22] multipathd: refactor path state getting code into a helper Benjamin Marzinski
2024-07-15 15:19   ` Martin Wilck
2024-07-15 16:07     ` Martin Wilck
2024-07-13  6:04 ` [PATCH 05/22] multipathd: handle uninitialized paths in new function Benjamin Marzinski
2024-07-15 15:34   ` Martin Wilck
2024-07-15 15:36     ` Martin Wilck
2024-07-16 14:23       ` Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 06/22] multipathd: make check_path() static Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 07/22] multipathd: remove redundant checks in handle_uninitialized_path() Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 08/22] multipathd: check paths immediately after failing udev initialization Benjamin Marzinski
2024-07-15 15:39   ` Martin Wilck
2024-07-13  6:04 ` [PATCH 09/22] multipathd: set pp->tick = max_checkint in handle_uninitialized_path Benjamin Marzinski
2024-07-15 16:00   ` Martin Wilck
2024-07-16 14:52     ` Benjamin Marzinski
2024-07-16 15:31       ` Martin Wilck
2024-07-13  6:04 ` [PATCH 10/22] multipathd: return 0 from path_check() if that path wasn't checked Benjamin Marzinski
2024-07-15 16:05   ` Martin Wilck
2024-07-16 14:52     ` Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 11/22] multipathd: reorder path state checks Benjamin Marzinski
2024-07-15 16:23   ` Martin Wilck
2024-07-13  6:04 ` [PATCH 12/22] multipathd: adjust when mpp is synced with the kernel Benjamin Marzinski
2024-07-15 16:23   ` Martin Wilck
2024-07-16 15:14     ` Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 13/22] multipathd: resync map after setup_map in ev_remove_path Benjamin Marzinski
2024-07-15 16:32   ` Martin Wilck
2024-07-16 15:15     ` Benjamin Marzinski [this message]
2024-07-13  6:04 ` [PATCH 14/22] multipathd: resync map after setup_map in resize_map Benjamin Marzinski
2024-07-13  6:04 ` [PATCH 15/22] multipathd: always resync map in reload_and_sync_map Benjamin Marzinski
2024-07-15 16:40   ` Martin Wilck
2024-07-13  6:05 ` [PATCH 16/22] multipathd: correctly handle paths removed for a wwid change Benjamin Marzinski
2024-07-15 19:16   ` Martin Wilck
2024-07-16 15:16     ` Benjamin Marzinski
2024-07-13  6:05 ` [PATCH 17/22] multipathd: handle changed wwid when adding partial path Benjamin Marzinski
2024-07-15 19:40   ` Martin Wilck
2024-07-16 15:45     ` Benjamin Marzinski
2024-07-13  6:05 ` [PATCH 18/22] multipathd: don't read conf->checkint twice in check_path Benjamin Marzinski
2024-07-15 19:41   ` Martin Wilck
2024-07-13  6:05 ` [PATCH 19/22] multipathd: make multipath devices manage their path check times Benjamin Marzinski
2024-07-15 20:49   ` Martin Wilck
2024-07-16 16:36     ` Martin Wilck
2024-07-16 18:26       ` Benjamin Marzinski
2024-07-16 18:23     ` Benjamin Marzinski
2024-07-13  6:05 ` [PATCH 20/22] multipathd: factor out actual path checking loop from checkerloop Benjamin Marzinski
2024-07-15 20:54   ` Martin Wilck
2024-07-13  6:05 ` [PATCH 21/22] multipathd: check paths in order by mpp Benjamin Marzinski
2024-07-15 21:19   ` Martin Wilck
2024-07-16 20:00     ` Benjamin Marzinski
2024-07-13  6:05 ` [PATCH 22/22] multipathd: clean up the correct wwid in check_path_wwid_change Benjamin Marzinski
2024-07-15 21:22   ` Martin Wilck
2024-07-16 20:00     ` Benjamin Marzinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZpaOmhu2y-AoEZHB@redhat.com \
    --to=bmarzins@redhat.com \
    --cc=christophe.varoqui@opensvc.com \
    --cc=dm-devel@lists.linux.dev \
    --cc=martin.wilck@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.