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

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