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

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