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

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