[dm-devel] [PATCH 3/3] multipathd: Add 'sysfs' prioritizer

Xose Vazquez Perez xose.vazquez at gmail.com
Tue Nov 8 18:52:55 UTC 2016


On 07/15/2016 08:48 AM, Hannes Reinecke wrote:

> Recent kernels have an 'access_state' attribute which allows
> us to read the asymmetric access state directly from sysfs.

Hi Hannes,

with this patch it's impossible to select/autodetect ALUA.
sysfs always takes precedence over alua.

"detect_prio no" was added to overrides section, to make
it work again.

SLES 12-SP2

Thank you.

> ---
>  libmultipath/discovery.c           | 33 +++++++++++++++++++++
>  libmultipath/discovery.h           |  2 ++
>  libmultipath/prio.h                |  1 +
>  libmultipath/prioritizers/Makefile |  3 +-
>  libmultipath/prioritizers/sysfs.c  | 61 ++++++++++++++++++++++++++++++++++++++
>  libmultipath/propsel.c             |  6 +++-
>  multipath/multipath.conf.5         | 19 ++++++++++--
>  7 files changed, 120 insertions(+), 5 deletions(-)
>  create mode 100644 libmultipath/prioritizers/sysfs.c
> 

[ ...]

> diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
> index beb0798..0caf269 100644
> --- a/libmultipath/propsel.c
> +++ b/libmultipath/propsel.c
> @@ -375,6 +375,8 @@ detect_prio(struct config *conf, struct path * pp)
>  	struct prio *p = &pp->prio;
>  	int tpgs = 0;
>  	unsigned int timeout = conf->checker_timeout;
> +	char buff[512];
> +	char *default_prio = PRIO_ALUA;
>  
>  	if ((tpgs = get_target_port_group_support(pp->fd, timeout)) <= 0)
>  		return;
> @@ -384,7 +386,9 @@ detect_prio(struct config *conf, struct path * pp)
>  		return;
>  	if (get_asymmetric_access_state(pp->fd, ret, timeout) < 0)
>  		return;
> -	prio_get(conf->multipath_dir, p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
> +	if (sysfs_get_asymmetric_access_state(pp, buff, 512) >= 0)
> +		default_prio = PRIO_SYSFS;
> +	prio_get(conf->multipath_dir, p, default_prio, DEFAULT_PRIO_ARGS);
>  }




More information about the dm-devel mailing list