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

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