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 12/22] multipathd: adjust when mpp is synced with the kernel
Date: Tue, 16 Jul 2024 11:14:34 -0400	[thread overview]
Message-ID: <ZpaOWqAbq0ibHsCg@redhat.com> (raw)
In-Reply-To: <b29efd52f75d1ef802c1b7e015657ee25d02bec1.camel@suse.com>

On Mon, Jul 15, 2024 at 06:23:53PM +0200, Martin Wilck wrote:
> On Sat, 2024-07-13 at 02:04 -0400, Benjamin Marzinski wrote:
> > Move the code to sync the mpp device state into a helper function and
> > add a counter to to make sure that the device is synced at least once
> > every max_checkint secs. This makes sure that multipath devices with
> > no
> > paths will still get synced with the kernel.  Also, if multiple paths
> > are checked in the same loop, the multipath device will only be
> > synced
> > with the kernel once, since every time the mpp is synced in any code
> > path, mpp->sync_tick is reset.
> > 
> > The code still syncs the mpp before updating the path state for two
> > main reasons.
> > 
> > 1. Sometimes multipathd leaves the mpp with a garbage state. Future
> >    patches will fix most of these cases, but the code intentially
> >    does not remove the mpp is resyncing fails while checking paths.
> >    But this does leave the mpp with a garbage state.
> > 
> > 2. The kernel chages the multipath state independently of multipathd.
> > If
> >    the kernel fails a path, a uevent will arrive shortly. But the
> > kernel
> >    doesn't provide any notification when it switches the active
> >    path group or if it ends up picking a different one than
> > multipathd
> >    selected. Multipathd needs to know the actual current pathgroup to
> >    know when it should be switching them.
> > 
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > ---
> >  libmultipath/configure.c   |  1 +
> >  libmultipath/structs.h     |  2 ++
> >  libmultipath/structs_vec.c |  5 +++
> >  multipathd/main.c          | 64 +++++++++++++++++++++++++-----------
> > --
> >  4 files changed, 50 insertions(+), 22 deletions(-)
> > 
> > 
> > diff --git a/multipathd/main.c b/multipathd/main.c
> > index fbd253ca..179fec24 100644
> > --- a/multipathd/main.c
> > +++ b/multipathd/main.c


> > @@ -2752,12 +2767,17 @@ checkerloop (void *ap)
> >  		while (checker_state != CHECKER_FINISHED) {
> >  			unsigned int paths_checked = 0, i;
> >  			struct timespec chk_start_time;
> > +			struct multipath *mpp;
> >  
> >  			pthread_cleanup_push(cleanup_lock, &vecs-
> > >lock);
> >  			lock(&vecs->lock);
> >  			pthread_testcancel();
> > +			vector_foreach_slot(vecs->mpvec, mpp, i)
> > +				mpp->is_checked = false;
> 
> Why is this not done inside the "if (checker_state == CHECKER_STARTING)
> code path?

Since we slept here, there was more time for something to change in a
way where we needed to resync the state. Also, like I mention in the
comments, there are places where we fail in some function that is
updating the mpp state and don't resync it with the kernel. I'm fairly
sure (but not totally certain) future patches catch all of these except
for failing to update the state in the checker function itself. (We've
never removed the multipath device for failing to resync its state in
the check_path(), unlike failures when responding to an event or after
reloading the device. This makes sense to me. Since we're doing these
resyncs in check_path() routinely, not because we think something has
changed, it seems reasonable to assume that nothing has changed if we
fail to resync).

Clearing is_checked here doesn't guarantee that we will resync the mpp.
Only that we will resync if we need to check one of its paths, after the
interruption. When we switch to checking paths by mpp later, this will
never happen, except in corner cases.

-Ben 

> Martin
> 
> 
> >  			get_monotonic_time(&chk_start_time);
> >  			if (checker_state == CHECKER_STARTING) {
> > +				vector_foreach_slot(vecs->mpvec,
> > mpp, i)
> > +					check_mpp(vecs, mpp, ticks);
> >  				vector_foreach_slot(vecs->pathvec,
> > pp, i)
> >  					pp->is_checked = false;
> >  				checker_state = CHECKER_RUNNING;


  reply	other threads:[~2024-07-16 15:14 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 [this message]
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
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=ZpaOWqAbq0ibHsCg@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.