Blame SOURCES/0042-multipathd-disallow-changing-to-from-fpin-marginal-p.patch

e65fa3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
e65fa3
From: Benjamin Marzinski <bmarzins@redhat.com>
e65fa3
Date: Fri, 11 Feb 2022 17:23:39 -0600
e65fa3
Subject: [PATCH] multipathd: disallow changing to/from fpin marginal paths on
e65fa3
 reconfig
e65fa3
e65fa3
Setting marginal_pathgroups to fpin causes two new threads to be created
e65fa3
when multipathd starts.  Turning it on after multipathd starts up won't
e65fa3
cause the theads to start, and turing it off won't keep the threads from
e65fa3
working. So disallow changing marginal_pathgroups to/from "fpin" on
e65fa3
reconfigure.
e65fa3
e65fa3
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
e65fa3
---
e65fa3
 multipath/multipath.conf.5 | 13 ++++++++-----
e65fa3
 multipathd/main.c          |  9 +++++++++
e65fa3
 2 files changed, 17 insertions(+), 5 deletions(-)
e65fa3
e65fa3
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
e65fa3
index 5ed2cd3c..58ad5c9c 100644
e65fa3
--- a/multipath/multipath.conf.5
e65fa3
+++ b/multipath/multipath.conf.5
e65fa3
@@ -1102,15 +1102,18 @@ have been tried first. This prevents the possibility of IO errors occuring
e65fa3
 while marginal paths are still usable. After the path has been monitored
e65fa3
 for the configured time, and is declared healthy, it will be returned to its
e65fa3
 normal pathgroup.
e65fa3
-However if this option is set to \fIfpin\fR multipathd will receive fpin
e65fa3
+If this option is set to \fIfpin\fR, multipathd will receive fpin
e65fa3
 notifications, set path states to "marginal" accordingly, and regroup paths
e65fa3
-as described for "marginal_pathgroups yes". This option can't be used in combination
e65fa3
-with other options for "Shaky path detection" (see below).If it is set to fpin,
e65fa3
-marginal_path_xyz and san_path_err_xyz parameters are implicitly set to 0.
e65fa3
+as described for \fIon\fR. This option can't be used in combination
e65fa3
+with other options for "Shaky path detection" (see below). \fBNote:\fR If this
e65fa3
+is set to \fIfpin\fR, the \fImarginal_path_*\fR and \fIsan_path_err_*\fR
e65fa3
+options are implicitly set to \fIno\fP. Also, this option cannot be switched
e65fa3
+either to or from \fIfpin\fR on a multipathd reconfigure. multipathd must be
e65fa3
+restarted for the change to take effect.
e65fa3
 See "Shaky paths detection" below for more information.
e65fa3
 .RS
e65fa3
 .TP
e65fa3
-The default is: \fBno\fR
e65fa3
+The default is: \fBoff\fR
e65fa3
 .RE
e65fa3
 .
e65fa3
 .
e65fa3
diff --git a/multipathd/main.c b/multipathd/main.c
e65fa3
index 53be9b95..45b9572f 100644
e65fa3
--- a/multipathd/main.c
e65fa3
+++ b/multipathd/main.c
e65fa3
@@ -2792,6 +2792,7 @@ int
e65fa3
 reconfigure (struct vectors * vecs)
e65fa3
 {
e65fa3
 	struct config * old, *conf;
e65fa3
+	int old_marginal_pathgroups;
e65fa3
 
e65fa3
 	conf = load_config(DEFAULT_CONFIGFILE);
e65fa3
 	if (!conf)
e65fa3
@@ -2819,6 +2820,14 @@ reconfigure (struct vectors * vecs)
e65fa3
 	uxsock_timeout = conf->uxsock_timeout;
e65fa3
 
e65fa3
 	old = rcu_dereference(multipath_conf);
e65fa3
+	old_marginal_pathgroups = old->marginal_pathgroups;
e65fa3
+	if ((old_marginal_pathgroups == MARGINAL_PATHGROUP_FPIN) !=
e65fa3
+	    (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN)) {
e65fa3
+		condlog(1, "multipathd must be restarted to turn %s fpin marginal paths",
e65fa3
+			(old_marginal_pathgroups == MARGINAL_PATHGROUP_FPIN)?
e65fa3
+			"off" : "on");
e65fa3
+		conf->marginal_pathgroups = old_marginal_pathgroups;
e65fa3
+	}
e65fa3
 	conf->sequence_nr = old->sequence_nr + 1;
e65fa3
 	rcu_assign_pointer(multipath_conf, conf);
e65fa3
 	call_rcu(&old->rcu, rcu_free_config);