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

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