On Thu, 2026-03-12 at 11:38 -0700, Brian Bunker wrote:
> On Thu, Mar 12, 2026 at 9:32 AM Martin Wilck <[email protected]> wrote:
> 
> > Hi Brian,
> > 
> > On Wed, 2026-03-11 at 17:16 -0700, Brian Bunker wrote:
> > > Add an 'alua' path checker that uses RTPG to check path state,
> > > and an
> > > 'alua_cached' prioritizer that uses the checker's cached ALUA
> > > state.
> > > 
> > > The checker maps ALUA Asymmetric Access States to path states:
> > >   - AAS_OPTIMIZED, AAS_NON_OPTIMIZED -> PATH_UP
> > >   - AAS_STANDBY -> PATH_GHOST
> > >   - AAS_TRANSITIONING -> PATH_PENDING
> > >   - AAS_UNAVAILABLE, AAS_OFFLINE -> PATH_DOWN
> > > 
> > > The alua_cached prioritizer first checks for cached state from
> > > the
> > > alua
> > > checker, then falls back to sysfs, then to issuing RTPG directly.
> > > This
> > > maintains backward compatibility with other checker
> > > configurations.
> > > 
> > > When detect_checker is enabled, the alua checker is auto-selected
> > > for
> > > devices with TPGS support. When the alua checker is in use,
> > > detect_prio
> > > auto-selects the alua_cached prioritizer.
> > > 
> > > Signed-off-by: Brian Bunker <[email protected]>
> > 
> > Thanks! Just a few remarks for now.
> > 
> > Martin
> > 
> > > ---
> > >  libmultipath/Makefile                   |   5 +
> > >  libmultipath/checkers.c                 |   1 +
> > >  libmultipath/checkers.h                 |   1 +
> > >  libmultipath/checkers/Makefile          |   3 +-
> > >  libmultipath/checkers/alua.c            | 426
> > > ++++++++++++++++++++++++
> > >  libmultipath/checkers/alua.h            |  15 +
> > >  libmultipath/prio.c                     |   1 +
> > >  libmultipath/prio.h                     |   1 +
> > >  libmultipath/prioritizers/Makefile      |   1 +
> > >  libmultipath/prioritizers/alua_cached.c | 224 +++++++++++++
> > >  libmultipath/prioritizers/alua_rtpg.c   |  12 +-
> > >  libmultipath/prioritizers/alua_rtpg.h   |   1 +
> > >  libmultipath/prioritizers/sysfs.c       |   7 +-
> > >  libmultipath/propsel.c                  |  20 +-
> > >  libmultipath/structs.c                  |   2 +
> > >  libmultipath/structs.h                  |   3 +
> > >  16 files changed, 716 insertions(+), 7 deletions(-)
> > >  create mode 100644 libmultipath/checkers/alua.c
> > >  create mode 100644 libmultipath/checkers/alua.h
> > >  create mode 100644 libmultipath/prioritizers/alua_cached.c
> > 

[...]

> > Instead of duplicating the threading implementation of the TUR
> > checker
> > here we should abstract it out and use the common framework by both
> > checkers (and others, too, maybe). This is a thing I've wanted to
> > do
> > for a long time. Maybe it's time to start doing it now.
> > 
> I considered that sort of re-work, but I was concerned that changes
> adding to the existing checker might muddy the waters. There are
> certainly
> changes where helper functions could be extracted for both checkers
> to leverage them.
> 

I didn't mean to say that _you_ have to do it. I see it as my job,
actually. The question is whether you are willing to wait until I get
to it...

[...]

> > > --- a/libmultipath/prioritizers/Makefile
> > > +++ b/libmultipath/prioritizers/Makefile
> > > @@ -13,6 +13,7 @@ LIBDEPS = -lmultipath -lmpathutil -lm -lpthread
> > > -
> > > lrt
> > >  # If you add or remove a prioritizer also update
> > > multipath/multipath.conf.5
> > >  LIBS = \
> > >       libprioalua.so \
> > > +     libprioalua_cached.so \
> > >       libprioconst.so \
> > >       libpriodatacore.so \
> > >       libprioemc.so \
> > 
> > I think the below should go into a separate patch.
> > 
> Can they be separated? The prioritizer's logic relies
> on the checker populating values for its decision.
> 

First the checker, then the prioritizer?

> > 
> > > diff --git a/libmultipath/prioritizers/alua_cached.c
> > > b/libmultipath/prioritizers/alua_cached.c
> > > new file mode 100644
> > > index 00000000..2ba5b2e7
> > > --- /dev/null
> > > +++ b/libmultipath/prioritizers/alua_cached.c
> > > @@ -0,0 +1,224 @@
> > > +/*
> > > + * (C) Copyright IBM Corp. 2004, 2005   All Rights Reserved.
> > > + * Modified 2024 to support cached ALUA state from checker
> > > + *
> > > + * ALUA prioritizer that can use cached state from alua checker
> > > + * to avoid duplicate RTPG commands.
> > > + *
> > > + * This file is released under the GPL.
> > 
> > Please add a proper license header.
> > 
> > > + */
> > > +#include <stdio.h>
> > > +#include <string.h>
> > > +
> > > +#include <time.h>
> > > +
> > > +#include "debug.h"
> > > +#include "prio.h"
> > > +#include "structs.h"
> > > +#include "checkers.h"
> > > +#include "discovery.h"
> > > +
> > > +#include "alua.h"
> > > +
> > > +#define ALUA_PRIO_NOT_SUPPORTED                      1
> > > +#define ALUA_PRIO_RTPG_FAILED                        2
> > > +#define ALUA_PRIO_GETAAS_FAILED                      3
> > > +#define ALUA_PRIO_TPGS_FAILED                        4
> > > +#define ALUA_PRIO_NO_INFORMATION             5
> > > +#define ALUA_PRIO_CACHED_STALE                       6
> > > +
> > > +/* Maximum age of cached ALUA state in seconds */
> > > +#define ALUA_CACHE_MAX_AGE_SECS                      5
> > > +
> > > +static const char * aas_string[] = {
> > > +     [AAS_OPTIMIZED]         = "active/optimized",
> > > +     [AAS_NON_OPTIMIZED]     = "active/non-optimized",
> > > +     [AAS_STANDBY]           = "standby",
> > > +     [AAS_UNAVAILABLE]       = "unavailable",
> > > +     [AAS_LBA_DEPENDENT]     = "logical block dependent",
> > > +     [AAS_RESERVED]          = "ARRAY BUG: invalid TPGs state!",
> > > +     [AAS_OFFLINE]           = "offline",
> > > +     [AAS_TRANSITIONING]     = "transitioning between states",
> > > +};
> > 
> > We shouldn't duplicate the definition of these constants.
> 
> This was somewhat intentional though not efficient. I will
> do better with leveraging in the next patch.
> 
> 

OK.

Thanks
Martin



Reply via email to