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 06/15] libmultipath: split get_state into two functions
Date: Wed, 4 Sep 2024 14:43:01 -0400 [thread overview]
Message-ID: <ZtiqNcKZLJxAH1Dg@redhat.com> (raw)
In-Reply-To: <acde3728e780c2d0437487d76b932294ae7206d1.camel@suse.com>
On Wed, Sep 04, 2024 at 05:14:32PM +0200, Martin Wilck wrote:
> On Wed, 2024-08-28 at 18:17 -0400, Benjamin Marzinski wrote:
> > get_state() is now split into start_checker(), which runs the checker
> > but doesn't wait for async checkers, and get_state(), which returns
> > the
> > state from the checker, after waiting for async checkers if
> > necessary.
> >
> > Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
> > ---
> > libmultipath/discovery.c | 22 ++++++++++++++++------
> > libmultipath/discovery.h | 4 +++-
> > libmultipath/propsel.c | 1 +
> > multipathd/main.c | 4 +++-
> > 4 files changed, 23 insertions(+), 8 deletions(-)
> >
> > diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
> > index 5648be60..e0f46ff2 100644
> > --- a/libmultipath/discovery.c
> > +++ b/libmultipath/discovery.c
> > @@ -1974,30 +1974,29 @@ cciss_ioctl_pathinfo(struct path *pp)
> > }
> >
> > int
> > -get_state (struct path * pp, struct config *conf, int daemon, int
> > oldstate)
> > +start_checker (struct path * pp, struct config *conf, int daemon,
> > int oldstate)
> > {
> > struct checker * c = &pp->checker;
> > - int state;
> >
> > if (!checker_selected(c)) {
> > if (daemon) {
> > if (pathinfo(pp, conf, DI_SYSFS) !=
> > PATHINFO_OK) {
> > condlog(3, "%s: couldn't get sysfs
> > pathinfo",
> > pp->dev);
> > - return PATH_UNCHECKED;
> > + return -1;
> > }
> > }
> > select_detect_checker(conf, pp);
> > select_checker(conf, pp);
> > if (!checker_selected(c)) {
> > condlog(3, "%s: No checker selected", pp-
> > >dev);
> > - return PATH_UNCHECKED;
> > + return -1;
> > }
> > checker_set_fd(c, pp->fd);
> > if (checker_init(c, pp->mpp?&pp->mpp-
> > >mpcontext:NULL)) {
> > checker_clear(c);
> > condlog(3, "%s: checker init failed", pp-
> > >dev);
> > - return PATH_UNCHECKED;
> > + return -1;
> > }
> > }
> > if (pp->mpp && !c->mpcontext)
> > @@ -2008,6 +2007,15 @@ get_state (struct path * pp, struct config
> > *conf, int daemon, int oldstate)
> > else
> > checker_set_sync(c);
> > checker_check(c, oldstate);
> > + return 0;
> > +}
> > +
> > +int
> > +get_state (struct path * pp)
> > +{
> > + struct checker * c = &pp->checker;
> > + int state;
> > +
> > state = checker_get_state(c);
> > condlog(3, "%s: %s state = %s", pp->dev,
> > checker_name(c), checker_state_name(state));
> > @@ -2455,7 +2463,9 @@ int pathinfo(struct path *pp, struct config
> > *conf, int mask)
> >
> > if (mask & DI_CHECKER) {
> > if (path_state == PATH_UP) {
> > - int newstate = get_state(pp, conf, 0,
> > path_state);
> > + int newstate = PATH_UNCHECKED;
> > + if (start_checker(pp, conf, 0, path_state)
> > == 0)
> > + newstate = get_state(pp);
> > if (newstate != PATH_PENDING ||
> > pp->state == PATH_UNCHECKED ||
> > pp->state == PATH_WILD)
> > diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
> > index c93abf1c..f3e0c618 100644
> > --- a/libmultipath/discovery.h
> > +++ b/libmultipath/discovery.h
> > @@ -34,7 +34,9 @@ int path_discovery (vector pathvec, int flag);
> > int path_get_tpgs(struct path *pp); /* This function never returns
> > TPGS_UNDEF */
> > int do_tur (char *);
> > int path_offline (struct path *);
> > -int get_state (struct path * pp, struct config * conf, int daemon,
> > int state);
> > +int start_checker(struct path * pp, struct config * conf, int
> > daemon,
> > + int state);
> > +int get_state(struct path * pp);
> > int get_vpd_sgio (int fd, int pg, int vend_id, char * str, int
> > maxlen);
> > int pathinfo (struct path * pp, struct config * conf, int mask);
> > int alloc_path_with_pathinfo (struct config *conf, struct
> > udev_device *udevice,
> > diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
> > index a3fce203..ad771d35 100644
> > --- a/libmultipath/propsel.c
> > +++ b/libmultipath/propsel.c
> > @@ -700,6 +700,7 @@ out:
> > condlog(3, "%s: path_checker = %s %s", pp->dev,
> > checker_name(c), origin);
> > c->timeout = pp->checker_timeout;
> > + c->path_state = PATH_UNCHECKED;
>
> Should this be in 01/15 already?
Yeah. That makes sense.
-Ben
>
> Martin
next prev parent reply other threads:[~2024-09-04 18:43 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 22:17 [PATCH 00/15] Yet Another path checker refactor Benjamin Marzinski
2024-08-28 22:17 ` [PATCH 01/15] libmultipath: store checker_check() result in checker struct Benjamin Marzinski
2024-09-04 16:13 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 02/15] libmultipath: add missing checker function prototypes Benjamin Marzinski
2024-09-04 16:13 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 03/15] libmultipath: split out the code to wait for pending checkers Benjamin Marzinski
2024-09-04 15:01 ` Martin Wilck
2024-09-04 18:16 ` Benjamin Marzinski
2024-09-04 19:48 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 04/15] libmultipath: remove pending wait code from libcheck_check calls Benjamin Marzinski
2024-09-04 20:05 ` Martin Wilck
2024-09-04 21:17 ` Benjamin Marzinski
2024-09-05 7:53 ` Martin Wilck
2024-09-06 17:26 ` Benjamin Marzinski
2024-08-28 22:17 ` [PATCH 05/15] multipath-tools tests: fix up directio tests Benjamin Marzinski
2024-09-04 16:12 ` Martin Wilck
2024-09-04 18:29 ` Benjamin Marzinski
2024-09-04 19:36 ` Martin Wilck
2024-09-04 19:43 ` Martin Wilck
2024-09-04 22:53 ` Benjamin Marzinski
2024-09-05 7:57 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 06/15] libmultipath: split get_state into two functions Benjamin Marzinski
2024-09-04 15:14 ` Martin Wilck
2024-09-04 18:43 ` Benjamin Marzinski [this message]
2024-08-28 22:17 ` [PATCH 07/15] libmultipath: change path_offline to path_sysfs_state Benjamin Marzinski
2024-09-04 15:31 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 08/15] multipathd: split check_path_state into two functions Benjamin Marzinski
2024-08-28 22:17 ` [PATCH 09/15] multipathd: split do_checker_path Benjamin Marzinski
2024-08-28 22:17 ` [PATCH 10/15] multipathd: split check_path into two functions Benjamin Marzinski
2024-09-04 15:38 ` Martin Wilck
2024-09-04 18:51 ` Benjamin Marzinski
2024-09-05 19:02 ` Benjamin Marzinski
2024-09-06 7:45 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 11/15] multipathd: split handle_uninitialized_path " Benjamin Marzinski
2024-08-28 22:17 ` [PATCH 12/15] multipathd: split check_paths " Benjamin Marzinski
2024-08-28 22:17 ` [PATCH 13/15] multipathd: update priority once after updating all paths Benjamin Marzinski
2024-09-04 15:06 ` Martin Wilck
2024-09-04 18:54 ` Benjamin Marzinski
2024-09-04 18:57 ` Martin Wilck
2024-09-04 19:51 ` Benjamin Marzinski
2024-09-04 20:14 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 14/15] multipathd: remove pointless check Benjamin Marzinski
2024-09-04 16:07 ` Martin Wilck
2024-08-28 22:17 ` [PATCH 15/15] multipathd: fix deferred_failback_tick for reload removes Benjamin Marzinski
2024-09-04 16:10 ` Martin Wilck
2024-09-04 20:07 ` [PATCH 00/15] Yet Another path checker refactor Martin Wilck
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=ZtiqNcKZLJxAH1Dg@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.