From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Benjamin Marzinski Date: Wed, 13 Apr 2022 23:27:39 -0500 Subject: [PATCH] libmultipath: check the overrides pctable for path variables Paths will now also check the pctable when checking for attribtes that exists in both the overrides section and the protocol subsection. Values in a matching pcentry will be used in preference to values in the overrides hwentry. Signed-off-by: Benjamin Marzinski Reviewed-by: Martin Wilck --- libmultipath/propsel.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 25326eb6..209c1d67 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -79,6 +79,8 @@ static const char conf_origin[] = "(setting: multipath.conf defaults/devices section)"; static const char overrides_origin[] = "(setting: multipath.conf overrides section)"; +static const char overrides_pce_origin[] = + "(setting: multipath.conf overrides protocol section)"; static const char cmdline_origin[] = "(setting: multipath command line [-p] flag)"; static const char autodetect_origin[] = @@ -144,6 +146,27 @@ do { \ } \ } while (0) +#define pp_set_ovr_pce(var) \ +do { \ + struct pcentry *_pce; \ + int _i; \ + \ + if (conf->overrides) { \ + vector_foreach_slot(conf->overrides->pctable, _pce, _i) { \ + if (_pce->type == (int)bus_protocol_id(pp) && _pce->var) { \ + pp->var = _pce->var; \ + origin = overrides_pce_origin; \ + goto out; \ + } \ + } \ + if (conf->overrides->var) { \ + pp->var = conf->overrides->var; \ + origin = overrides_origin; \ + goto out; \ + } \ + } \ +} while (0) + int select_mode(struct config *conf, struct multipath *mp) { const char *origin; @@ -771,7 +794,7 @@ int select_fast_io_fail(struct config *conf, struct path *pp) const char *origin; char buff[12]; - pp_set_ovr(fast_io_fail); + pp_set_ovr_pce(fast_io_fail); pp_set_hwe(fast_io_fail); pp_set_conf(fast_io_fail); pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL); @@ -786,7 +809,7 @@ int select_dev_loss(struct config *conf, struct path *pp) const char *origin; char buff[12]; - pp_set_ovr(dev_loss); + pp_set_ovr_pce(dev_loss); pp_set_hwe(dev_loss); pp_set_conf(dev_loss); pp->dev_loss = 0; @@ -802,7 +825,7 @@ int select_eh_deadline(struct config *conf, struct path *pp) const char *origin; char buff[12]; - pp_set_ovr(eh_deadline); + pp_set_ovr_pce(eh_deadline); pp_set_hwe(eh_deadline); pp_set_conf(eh_deadline); pp->eh_deadline = EH_DEADLINE_UNSET;