Blame SOURCES/0101-libmultipath-check-the-overrides-pctable-for-path-va.patch

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