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

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