Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

231 changed files with 14095 additions and 8904 deletions

View File

@ -1 +1,2 @@
b52c2be340449664f0a122070838f6d8edd42e4a SOURCES/multipath-tools-0.8.4.tgz
067d668de8e3a70b7c176bbf0c0616d5835bbe44 multipath-tools-0.8.7.tgz
5d5e16cccc83fd78cf9b95e5c52cc41dbbeb1da7 multipath.conf

26
.gitignore vendored
View File

@ -1 +1,25 @@
SOURCES/multipath-tools-0.8.4.tgz
multipath-tools-091027.tar.gz
/multipath-tools-120123.tgz
/multipath-tools-120613.tgz
/multipath-tools-120821.tgz
/multipath-tools-130222.tgz
/multipath-tools-f21166a.tgz
/multipath.conf
/multipath-tools-git847cc43.tgz
/multipath-tools-0.7.3.tgz
/multipath-tools-07e7bd5.tgz
/multipath-tools-1cb704b.tgz
/multipath-tools-0.7.7.tgz
/multipath-tools-ef6d98b.tgz
/multipath-tools-1a8625a.tgz
/multipath-tools-b80318b.tgz
/multipath-tools-0.7.8.tgz
/multipath-tools-0.7.9.tgz
/multipath-tools-17a6101.tgz
/multipath-tools-2df6110.tgz
/multipath-tools-0.8.0.tgz
/multipath-tools-0.8.2.tgz
/multipath-tools-0.8.4.tgz
/multipath-tools-0.8.5.tgz
/multipath-tools-0.8.6.tgz
/multipath-tools-0.8.7.tgz

View File

@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Wed, 8 Sep 2021 22:33:54 +0200
Subject: [PATCH] multipath-tools: add info about IO affinity path selector to
manpage
Added in 5.11: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e4d2e82b2300b03f66b3ca8417590c86e661fab1
Cc: Mike Christie <michael.christie@oracle.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/multipath.conf.5 | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index d6b8c7f6..42a15ffd 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -6,7 +6,7 @@
.\"
.\" ----------------------------------------------------------------------------
.
-.TH MULTIPATH.CONF 5 2018-05-21 Linux
+.TH MULTIPATH.CONF 5 2021-09-08 Linux
.
.
.\" ----------------------------------------------------------------------------
@@ -210,6 +210,10 @@ of outstanding I/O to the path and its relative throughput.
estimation of future service time based on the history of previous I/O submitted
to each path.
.TP
+.I "io-affinity 0"
+(Since 5.11 kernel) Choose the path for the next bunch of I/O based on a CPU to
+path mapping the user passes in and what CPU we are executing on.
+.TP
The default is: \fBservice-time 0\fR
.RE
.

View File

@ -0,0 +1,52 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: lixiaokeng <lixiaokeng@huawei.com>
Date: Mon, 13 Sep 2021 10:43:14 +0800
Subject: [PATCH] multipathd: fix missing persistent reseravtion for active
path
There are two paths(sucu as sda and adb) for one LUN. The two
paths log in, but before the two uevents have been processed
(for example there are many uevent), users use multipathd add
path /dev/sda to cause mpatha and use mpathpersist -o -I to
register prkey for mpatha. The add map uevent is after add path
uevent, the the uevent(add sdb) will delay and missing persistent
reseravtion check.
Here, we add persistent reseravtion check in update_map() which
is called ev_add_map().
Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/multipathd/main.c b/multipathd/main.c
index 3aff241d..1defeaf1 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -490,6 +490,8 @@ update_map (struct multipath *mpp, struct vectors *vecs, int new_map)
{
int retries = 3;
char *params __attribute__((cleanup(cleanup_charp))) = NULL;
+ struct path *pp;
+ int i;
retry:
condlog(4, "%s: updating new map", mpp->alias);
@@ -502,6 +504,15 @@ retry:
verify_paths(mpp);
mpp->action = ACT_RELOAD;
+ if (mpp->prflag) {
+ vector_foreach_slot(mpp->paths, pp, i) {
+ if ((pp->state == PATH_UP) || (pp->state == PATH_GHOST)) {
+ /* persistent reseravtion check*/
+ mpath_pr_event_handle(pp);
+ }
+ }
+ }
+
if (setup_map(mpp, &params, vecs)) {
condlog(0, "%s: failed to setup new map in update", mpp->alias);
retries = -1;

View File

@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Thu, 16 Sep 2021 00:44:49 +0200
Subject: [PATCH] multipath-tools: minor fixes to multipath.conf.5 man page
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/multipath.conf.5 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 42a15ffd..c74129bd 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1,9 +1,9 @@
.\" ----------------------------------------------------------------------------
-.\" Update the date below if you make any significant change.
.\" Make sure there are no errors with:
.\" groff -z -wall -b -e -t multipath/multipath.conf.5
.\" man --warnings -E UTF-8 -l -Tutf8 -Z multipath/multipath.conf.5 >/dev/null
.\"
+.\" Update the date below if you make any significant change.
.\" ----------------------------------------------------------------------------
.
.TH MULTIPATH.CONF 5 2021-09-08 Linux
@@ -189,7 +189,7 @@ The default is: \fB<system dependent>\fR
.TP
.B path_selector
The default path selector algorithm to use; they are offered by the
-kernel multipath target. There are three selector algorithms:
+kernel multipath target:
.RS
.TP 12
.I "round-robin 0"
@@ -206,7 +206,7 @@ of outstanding I/O to the path.
of outstanding I/O to the path and its relative throughput.
.TP
.I "historical-service-time 0"
-(Since 5.8 kernel) Choose the path for the next bunch of IOs based on the
+(Since 5.8 kernel) Choose the path for the next bunch of I/O based on the
estimation of future service time based on the history of previous I/O submitted
to each path.
.TP

View File

@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Sat, 25 Sep 2021 00:27:36 +0200
Subject: [PATCH] multipath-tools: make IBM/XIV config work with alua and
multibus
And add recommended pgfailback value.
ALUA is supported since XIV_Gen2 and microcode 10.2.1
(All ports across all controllers in single Target Port Group)
https://www.ibm.com/support/pages/ibm-flashsystem%C2%AE-a9000-and-a9000r-hyperswap-solution-deployment-linux%C2%AE-ibm-z-systems%C2%AE
https://www.google.com/search?q=%222810XIV%22+%22path_grouping_policy%22+site%3Aibm.com
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 0caac0da..72f81c60 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -712,7 +712,8 @@ static struct hwentry default_hw[] = {
.vendor = "(XIV|IBM)",
.product = "(NEXTRA|2810XIV)",
.no_path_retry = NO_PATH_RETRY_QUEUE,
- .pgpolicy = MULTIBUS,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = 15,
},
{
/* TMS RamSan / FlashSystem 710/720/810/820/840/900 */

View File

@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Luca BRUNO <luca.bruno@coreos.com>
Date: Fri, 24 Sep 2021 09:34:01 +0000
Subject: [PATCH] multipathd.socket: add missing conditions from service unit
This aligns 'multipathd' socket and service units, by adding the
start conditions that are set on the service but not on the socket.
It should help avoiding situations where the socket unit ends up
marked as failed after hitting its retry-limit.
Fixes: https://github.com/opensvc/multipath-tools/issues/15
Signed-off-by: Luca BRUNO <luca.bruno@coreos.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/multipathd.socket | 3 +++
1 file changed, 3 insertions(+)
diff --git a/multipathd/multipathd.socket b/multipathd/multipathd.socket
index 0ed4a1f7..c777e5e3 100644
--- a/multipathd/multipathd.socket
+++ b/multipathd/multipathd.socket
@@ -1,6 +1,9 @@
[Unit]
Description=multipathd control socket
DefaultDependencies=no
+ConditionKernelCommandLine=!nompath
+ConditionKernelCommandLine=!multipath=off
+ConditionVirtualization=!container
Before=sockets.target
[Socket]

View File

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Tue, 28 Sep 2021 18:52:10 +0200
Subject: [PATCH] multipath-tools: make IBM/2107900 (DS8000) config work with
alua and multibus
ALUA is supported since the beginning:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/scsi/device_handler/scsi_dh_alua.c?id=057ea7c9683c3d684128cced796f03c179ecf1c2#n683
... the DS8000 is an Asymmetric Logical Unit Access (ALUA) capable storage array,
pag#160(144): https://www.redbooks.ibm.com/redbooks/pdfs/sg248887.pdf
kernel log:
https://marc.info/?l=linux-scsi&m=156407413807511&q=mbox
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 72f81c60..f115c4f9 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -656,7 +656,8 @@ static struct hwentry default_hw[] = {
.vendor = "IBM",
.product = "^2107900",
.no_path_retry = NO_PATH_RETRY_QUEUE,
- .pgpolicy = MULTIBUS,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
},
{
// Storwize V5000 and V7000 lines / SAN Volume Controller (SVC) / Flex System V7000 /

View File

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Tue, 28 Sep 2021 19:20:59 +0200
Subject: [PATCH] multipath-tools: make EMC/SYMMETRIX config work with alua and
multibus
ALUA is supported since VMAX3 and HYPERMAX OS 5977.811.784, pag#113:
https://www.delltechnologies.com/en-us/collaterals/unauth/technical-guides-support-information/products/storage-2/docu5128.pdf
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index f115c4f9..7095aaf1 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -329,8 +329,9 @@ static struct hwentry default_hw[] = {
/* Symmetrix / DMX / VMAX / PowerMax */
.vendor = "EMC",
.product = "SYMMETRIX",
- .pgpolicy = MULTIBUS,
+ .pgpolicy = GROUP_BY_PRIO,
.no_path_retry = 6,
+ .pgfailback = -FAILBACK_IMMEDIATE,
},
{
/* DGC CLARiiON CX/AX / VNX and Unity */

View File

@ -0,0 +1,37 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Tue, 28 Sep 2021 19:31:21 +0200
Subject: [PATCH] multipath-tools: make EMC/Invista config work with alua and
multibus
Optimal Path Management (OPM) was introduced with VPLEX 5.5 to improve VPLEX
performance. OPM uses the ALUA mechanism to spread the I/O load across VPLEX directors
while gaining cache locality, pag #187:
https://www.delltechnologies.com/en-us/collaterals/unauth/technical-guides-support-information/products/storage-2/docu5128.pdf
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 7095aaf1..4e8b52ff 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -350,8 +350,9 @@ static struct hwentry default_hw[] = {
.vendor = "EMC",
.product = "Invista",
.bl_product = "LUNZ",
- .pgpolicy = MULTIBUS,
+ .pgpolicy = GROUP_BY_PRIO,
.no_path_retry = 5,
+ .pgfailback = -FAILBACK_IMMEDIATE,
},
{
/* XtremIO */

View File

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Tue, 28 Sep 2021 22:15:56 +0200
Subject: [PATCH] multipath-tools: make "COMPELNT/Compellent Vol" config work
with alua and multibus
ALUA is needed by SAS arrays, pag#124:
https://downloads.dell.com/manuals/all-products/esuprt_solutions_int/esuprt_solutions_int_solutions_resources/general-solution-resources_white-papers2_en-us.pdf
Cc: Sean McGinnis <sean_mcginnis@dell.com>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 4e8b52ff..7fc5bc04 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -368,7 +368,8 @@ static struct hwentry default_hw[] = {
*/
.vendor = "COMPELNT",
.product = "Compellent Vol",
- .pgpolicy = MULTIBUS,
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
.no_path_retry = NO_PATH_RETRY_QUEUE,
},
{

View File

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Xose Vazquez Perez <xose.vazquez@gmail.com>
Date: Tue, 28 Sep 2021 22:39:17 +0200
Subject: [PATCH] multipath-tools: remove Compellent maintainer
e-mail was bounced: 550 5.1.1 User Unknown
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Cc: Christophe Varoqui <christophe.varoqui@opensvc.com>
Cc: DM-DEVEL ML <dm-devel@redhat.com>
Signed-off-by: Xose Vazquez Perez <xose.vazquez@gmail.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 7fc5bc04..763982cd 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -361,11 +361,7 @@ static struct hwentry default_hw[] = {
.pgpolicy = MULTIBUS,
},
{
- /*
- * SC Series, formerly Compellent
- *
- * Maintainer: Sean McGinnis <sean_mcginnis@dell.com>
- */
+ /* SC Series, formerly Compellent */
.vendor = "COMPELNT",
.product = "Compellent Vol",
.pgpolicy = GROUP_BY_PRIO,

View File

@ -0,0 +1,35 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 20 Oct 2021 20:44:54 +0200
Subject: [PATCH] Revert "multipath-tools: make EMC/Invista config work with
alua and multibus"
This reverts commit 309ff281aaa07e862540d3d645a8263f3e9baaed.
Mail from <Wayne.Berthiaume@dell.com>, 20210930:
"OPM is no longer supported in the Dell VPLEX product. If we at Dell had
wished to change the default device stanzas for any of our products they
would have been done when the product and/or feature is released.
Please remove this patch as well. It is not needed."
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 763982cd..211087ad 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -350,9 +350,8 @@ static struct hwentry default_hw[] = {
.vendor = "EMC",
.product = "Invista",
.bl_product = "LUNZ",
- .pgpolicy = GROUP_BY_PRIO,
+ .pgpolicy = MULTIBUS,
.no_path_retry = 5,
- .pgfailback = -FAILBACK_IMMEDIATE,
},
{
/* XtremIO */

View File

@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Wed, 20 Oct 2021 20:46:09 +0200
Subject: [PATCH] Revert "multipath-tools: make EMC/SYMMETRIX config work with
alua and multibus"
This reverts commit 831af0dbfa171cd39d968ba6174669f11a278be9.
Mail from "berthiaume, wayne" <Wayne.Berthiaume@dell.com>, 210930:
"As a representative of Dell I request this patch be withdrawn. If we had
wanted the default stanza changed we would have already implemented it.
Also for your information we only advertise the entire enterprise storage
product line (DMX, VMAX, VMAX AFA, PowerMax) as SYMMETRIX in the VPD page.
The ALUA capability is only used for mobility devices in an SRDF/Metro
configuration and the current device stanza still works well in all of our
testing."
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 211087ad..a8ba28e3 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -329,9 +329,8 @@ static struct hwentry default_hw[] = {
/* Symmetrix / DMX / VMAX / PowerMax */
.vendor = "EMC",
.product = "SYMMETRIX",
- .pgpolicy = GROUP_BY_PRIO,
+ .pgpolicy = MULTIBUS,
.no_path_retry = 6,
- .pgfailback = -FAILBACK_IMMEDIATE,
},
{
/* DGC CLARiiON CX/AX / VNX and Unity */

View File

@ -15,10 +15,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 9060ac9b..034752d9 100644
index d0ec9b44..2a75dc9c 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -53,7 +53,7 @@ endif
@@ -55,7 +55,7 @@ endif
prefix =
exec_prefix = $(prefix)
usr_prefix = $(prefix)
@ -28,10 +28,10 @@ index 9060ac9b..034752d9 100644
udevrulesdir = $(libudevdir)/rules.d
multipathdir = $(TOPDIR)/libmultipath
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 8f990494..8a3a1718 100644
index d7527d7d..0e0d70d5 100644
--- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules
@@ -32,6 +32,6 @@ LABEL="mpath_kpartx_end"
@@ -36,6 +36,6 @@ LABEL="mpath_kpartx_end"
GOTO="kpartx_end"
LABEL="run_kpartx"
@ -61,6 +61,3 @@ index 0828a8f7..b9bbb3cf 100644
$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz
$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
--
2.17.2

View File

@ -13,29 +13,26 @@ it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/blacklist.c | 9 ++-------
libmultipath/blacklist.c | 6 ++----
multipath/multipath.conf.5 | 11 ++++++-----
tests/blacklist.c | 6 ++----
3 files changed, 10 insertions(+), 16 deletions(-)
tests/blacklist.c | 7 ++-----
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
index 00e8dbdb..d9691b17 100644
index 4e315c97..1e463ef6 100644
--- a/libmultipath/blacklist.c
+++ b/libmultipath/blacklist.c
@@ -204,12 +204,6 @@ setup_default_blist (struct config * conf)
if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
@@ -202,9 +202,6 @@ setup_default_blist (struct config * conf)
if (store_ble(conf->blist_devnode, "!^(sd[a-z]|dasd[a-z]|nvme[0-9])", ORIGIN_DEFAULT))
return 1;
- str = STRDUP("(SCSI_IDENT_|ID_WWN)");
- if (!str)
- return 1;
- if (store_ble(conf->elist_property, str, ORIGIN_DEFAULT))
- if (store_ble(conf->elist_property, "(SCSI_IDENT_|ID_WWN)", ORIGIN_DEFAULT))
- return 1;
-
vector_foreach_slot (conf->hwtable, hwe, i) {
if (hwe->bl_product) {
if (find_blacklist_device(conf->blist_device,
@@ -411,7 +405,8 @@ filter_property(struct config *conf, struct udev_device *udev, int lvl,
@@ -410,7 +407,8 @@ filter_property(const struct config *conf, struct udev_device *udev,
*uid_attribute != '\0';
bool uid_attr_seen = false;
@ -46,10 +43,10 @@ index 00e8dbdb..d9691b17 100644
udev_device_get_properties_list_entry(udev)) {
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 05a5e8ff..3455b1cc 100644
index c74129bd..dd9f4dc7 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1286,9 +1286,14 @@ keywords. Both are regular expressions. For a full description of these keywords
@@ -1351,9 +1351,14 @@ keywords. Both are regular expressions. For a full description of these keywords
Regular expression for an udev property. All
devices that have matching udev properties will be excluded/included.
The handling of the \fIproperty\fR keyword is special,
@ -65,7 +62,7 @@ index 05a5e8ff..3455b1cc 100644
.
.RS
.PP
@@ -1299,10 +1304,6 @@ Blacklisting by missing properties is only applied to devices which do have the
@@ -1364,10 +1369,6 @@ Blacklisting by missing properties is only applied to devices which do have the
property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR)
set. Previously, it was applied to every device, possibly causing devices to be
blacklisted because of temporary I/O error conditions.
@ -77,19 +74,21 @@ index 05a5e8ff..3455b1cc 100644
.TP
.B protocol
diff --git a/tests/blacklist.c b/tests/blacklist.c
index 6e7c1864..cc8a9a4a 100644
index 882aa3a1..6a22b660 100644
--- a/tests/blacklist.c
+++ b/tests/blacklist.c
@@ -271,7 +271,7 @@ static void test_property_missing(void **state)
@@ -375,9 +375,8 @@ static void test_property_missing(void **state)
{
static struct udev_device udev = { "sdb", { "ID_FOO", "ID_BAZ", "ID_BAR", "ID_SERIAL", NULL } };
conf.blist_property = blist_property_wwn;
expect_condlog(3, "sdb: blacklisted, udev property missing\n");
- expect_condlog(3, "sdb: blacklisted, udev property missing\n");
assert_int_equal(filter_property(&conf, &udev, 3, "ID_SERIAL"),
- MATCH_PROPERTY_BLIST_MISSING);
+ MATCH_NOTHING);
assert_int_equal(filter_property(&conf, &udev, 3, "ID_BLAH"),
MATCH_NOTHING);
assert_int_equal(filter_property(&conf, &udev, 3, ""),
@@ -363,9 +363,7 @@ static void test_filter_path_missing1(void **state)
@@ -469,9 +468,7 @@ static void test_filter_path_missing1(void **state)
conf.blist_device = blist_device_foo_bar;
conf.blist_protocol = blist_protocol_fcp;
conf.blist_wwid = blist_wwid_xyzzy;
@ -100,6 +99,3 @@ index 6e7c1864..cc8a9a4a 100644
}
/* This one matches the property whitelist, to test the other missing
--
2.17.2

View File

@ -12,26 +12,19 @@ simple way to disable multipath. Simply removing or renaming
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 15 +++++++++++++++
libmultipath/config.c | 13 +++++++++++++
libmultipath/config.h | 1 +
multipath/multipath.rules | 1 +
multipathd/multipathd.8 | 2 ++
multipathd/multipathd.service | 1 +
5 files changed, 20 insertions(+)
multipathd/multipathd.socket | 1 +
6 files changed, 19 insertions(+)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index b4d87689..b36778b0 100644
index 30046a17..5f35c3d3 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -26,6 +26,7 @@
#include "devmapper.h"
#include "mpath_cmd.h"
#include "propsel.h"
+#include "version.h"
static int
hwe_strmatch (const struct hwentry *hwe1, const struct hwentry *hwe2)
@@ -778,6 +779,20 @@ load_config (char * file)
@@ -895,6 +895,19 @@ int _init_config (const char *file, struct config *conf)
goto out;
}
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
@ -44,8 +37,7 @@ index b4d87689..b36778b0 100644
+ goto out;
+ }
+ }
+ if (store_ble(conf->blist_devnode, strdup(".*"),
+ ORIGIN_NO_CONFIG)) {
+ if (store_ble(conf->blist_devnode, ".*", ORIGIN_NO_CONFIG)) {
+ condlog(0, "cannot store default no-config blacklist\n");
+ goto out;
+ }
@ -53,7 +45,7 @@ index b4d87689..b36778b0 100644
conf->processed_main_config = 1;
diff --git a/libmultipath/config.h b/libmultipath/config.h
index ceecff2d..3368d8c9 100644
index 933fe0d1..5f01c1fc 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -9,6 +9,7 @@
@ -62,8 +54,8 @@ index ceecff2d..3368d8c9 100644
#define ORIGIN_CONFIG 1
+#define ORIGIN_NO_CONFIG 2
/*
* In kernel, fast_io_fail == 0 means immediate failure on rport delete.
enum devtypes {
DEV_NONE,
diff --git a/multipath/multipath.rules b/multipath/multipath.rules
index 9df11a95..0486bf70 100644
--- a/multipath/multipath.rules
@ -90,17 +82,26 @@ index 048a838d..8bd47a80 100644
.
.\" ----------------------------------------------------------------------------
diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
index ba24983e..17434cef 100644
index 0b2ac814..6d57c7e8 100644
--- a/multipathd/multipathd.service
+++ b/multipathd/multipathd.service
@@ -4,6 +4,7 @@ Wants=systemd-udev-trigger.service systemd-udev-settle.service
Before=iscsi.service iscsid.service lvm2-activation-early.service
Before=local-fs-pre.target blk-availability.service
Before=local-fs-pre.target blk-availability.service shutdown.target
After=multipathd.socket systemd-udev-trigger.service systemd-udev-settle.service
+ConditionPathExists=/etc/multipath.conf
DefaultDependencies=no
Conflicts=shutdown.target
ConditionKernelCommandLine=!nompath
--
2.17.2
diff --git a/multipathd/multipathd.socket b/multipathd/multipathd.socket
index c777e5e3..3c20a2ff 100644
--- a/multipathd/multipathd.socket
+++ b/multipathd/multipathd.socket
@@ -1,6 +1,7 @@
[Unit]
Description=multipathd control socket
DefaultDependencies=no
+ConditionPathExists=/etc/multipath.conf
ConditionKernelCommandLine=!nompath
ConditionKernelCommandLine=!multipath=off
ConditionVirtualization=!container

View File

@ -1,7 +1,10 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 25 Jan 2019 14:54:56 -0600
Subject: [PATCH] RH: Fix nvme compilation warning
Subject: [PATCH] RH: Fix nvme function missing argument
A future patch will change the compilation options to error when
function declarations have unspecified arguments.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
@ -21,6 +24,3 @@ index adb192b6..bfd10ef8 100644
void argconfig_append_usage(const char *str);
void argconfig_print_help(const char *program_desc,
const struct argconfig_commandline_options *options);
--
2.17.2

View File

@ -0,0 +1,66 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 19 Apr 2017 06:10:01 -0500
Subject: [PATCH] RH: use rpm optflags if present
Use the passed in optflags when compiling as an RPM, and keep the
default flags as close as possible to the current fedora flags, while
still being generic.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 2a75dc9c..5ac660de 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -92,23 +92,35 @@ TEST_CC_OPTION = $(shell \
echo "$(2)"; \
fi)
-STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
ERROR_DISCARDED_QUALIFIERS := $(call TEST_CC_OPTION,-Werror=discarded-qualifiers,)
WNOCLOBBERED := $(call TEST_CC_OPTION,-Wno-clobbered -Wno-error=clobbered,)
WFORMATOVERFLOW := $(call TEST_CC_OPTION,-Wformat-overflow=2,)
-OPTFLAGS := -O2 -g $(STACKPROT) --param=ssp-buffer-size=4
-WARNFLAGS := -Werror -Wall -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \
+ifndef RPM_OPT_FLAGS
+ STACKPROT := $(call TEST_CC_OPTION,-fstack-protector-strong,-fstack-protector)
+ OPTFLAGS := -O2 -g -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions \
+ $(STACKPROT) -grecord-gcc-switches \
+ -fasynchronous-unwind-tables --param=ssp-buffer-size=4
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-hardened-cc1 && echo 1),1)
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
+ endif
+ ifeq ($(shell test -f /usr/lib/rpm/redhat/redhat-annobin-cc1 && echo 1),1)
+ OPTFLAGS += -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
+ endif
+else
+ OPTFLAGS := $(RPM_OPT_FLAGS) --param=ssp-buffer-size=4
+endif
+WARNFLAGS := -Werror -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int \
-Werror=implicit-function-declaration -Werror=format-security \
- $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS)
-CPPFLAGS := -Wp,-D_FORTIFY_SOURCE=2
+ $(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
+ -Wstrict-prototypes
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
-DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
-MMD -MP
BIN_CFLAGS = -fPIE -DPIE
LIB_CFLAGS = -fPIC
SHARED_FLAGS = -shared
-LDFLAGS := $(LDFLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
+LDFLAGS := $(LDFLAGS) $(RPM_LD_FLAGS) -Wl,-z,relro -Wl,-z,now -Wl,-z,defs
BIN_LDFLAGS = -pie
# Check whether a function with name $1 has been declared in header file $2.
@@ -139,4 +151,4 @@ check_file = $(shell \
%.o: %.c
@echo building $@ because of $?
- $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) -c -o $@ $<

View File

@ -14,17 +14,17 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 2 +
multipath/Makefile | 5 +
multipath/mpathconf | 555 ++++++++++++++++++++++++++++++++++++++++++
multipath/mpathconf | 556 ++++++++++++++++++++++++++++++++++++++++++
multipath/mpathconf.8 | 135 ++++++++++
4 files changed, 697 insertions(+)
4 files changed, 698 insertions(+)
create mode 100644 multipath/mpathconf
create mode 100644 multipath/mpathconf.8
diff --git a/libmultipath/config.c b/libmultipath/config.c
index b36778b0..26f8e050 100644
index 5f35c3d3..cee3bbb7 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -781,6 +781,8 @@ load_config (char * file)
@@ -897,6 +897,8 @@ int _init_config (const char *file, struct config *conf)
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
} else {
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
@ -69,10 +69,10 @@ index b9bbb3cf..e720c7f6 100644
$(RM) core *.o $(EXEC) *.gz
diff --git a/multipath/mpathconf b/multipath/mpathconf
new file mode 100644
index 00000000..f34003c9
index 00000000..c00d2555
--- /dev/null
+++ b/multipath/mpathconf
@@ -0,0 +1,555 @@
@@ -0,0 +1,556 @@
+#!/bin/bash
+#
+# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
@ -107,11 +107,6 @@ index 00000000..f34003c9
+defaults {
+ user_friendly_names yes
+ find_multipaths yes
+ enable_foreign \"^$\"
+}
+
+blacklist_exceptions {
+ property \"(SCSI_IDENT_|ID_WWN)\"
+}"
+
+CONFIGFILE="/etc/multipath.conf"
@ -129,8 +124,8 @@ index 00000000..f34003c9
+ echo "Disable: --disable"
+ echo "Only allow certain wwids (instead of enable): --allow <WWID>"
+ echo "Set user_friendly_names (Default y): --user_friendly_names <y|n>"
+ echo "Set find_multipaths (Default y): --find_multipaths <y|n>"
+ echo "Set default property blacklist (Default y): --property_blacklist <y|n>"
+ echo "Set find_multipaths (Default y): --find_multipaths <yes|no|strict|greedy|smart>"
+ echo "Set default property blacklist (Default n): --property_blacklist <y|n>"
+ echo "Set enable_foreign to show foreign devices (Default n): --enable_foreign <y|n>"
+ echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
+ echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
@ -299,8 +294,12 @@ index 00000000..f34003c9
+ echo "--user_friendly_names must be either 'y' or 'n'"
+ exit 1
+ fi
+ if [ -n "$FIND" ] && [ "$FIND" != "y" -a "$FIND" != "n" ]; then
+ echo "--find_multipaths must be either 'y' or 'n'"
+ if [ "$FIND" = "y" ]; then
+ FIND="yes"
+ elif [ "$FIND" = "n" ]; then
+ FIND="no"
+ elif [ -n "$FIND" ] && [ "$FIND" != "yes" -a "$FIND" != "no" -a "$FIND" != "strict" -a "$FIND" != "greedy" -a "$FIND" != "smart" ]; then
+ echo "--find_multipaths must be one of 'yes' 'no' 'strict' 'greedy' or 'smart'"
+ exit 1
+ fi
+ if [ -n "$PROPERTY" ] && [ "$PROPERTY" != "y" -a "$PROPERTY" != "n" ]; then
@ -311,7 +310,7 @@ index 00000000..f34003c9
+ echo "--enable_foreign must be either 'y' or 'n'"
+ exit 1
+ fi
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" ]; then
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" -a -z "$FOREIGN" ]; then
+ SHOW_STATUS=1
+ fi
+ if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
@ -386,45 +385,50 @@ index 00000000..f34003c9
+fi
+
+if [ "$HAVE_BLACKLIST" = "1" ]; then
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode \"\.\?\*\"" ; then
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"" ; then
+ HAVE_DISABLE=1
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"" ; then
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"" ; then
+ HAVE_DISABLE=0
+ fi
+fi
+
+if [ "$HAVE_BLACKLIST" = "1" ]; then
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid \"\.\?\*\"" ; then
+ if sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"" ; then
+ HAVE_WWID_DISABLE=1
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"" ; then
+ elif sed -n '/^blacklist[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"" ; then
+ HAVE_WWID_DISABLE=0
+ fi
+fi
+
+if [ "$HAVE_DEFAULTS" = "1" ]; then
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)" ; then
+ HAVE_FIND=1
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)" ; then
+ HAVE_FIND=0
+ HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
+ if [ "$HAVE_FIND" = "1" ]; then
+ HAVE_FIND="yes"
+ elif [ "$HAVE_FIND" = "0" ]; then
+ HAVE_FIND="no"
+ fi
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)" ; then
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(yes\|1\)" ; then
+ HAVE_FRIENDLY=1
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)" ; then
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)" ; then
+ HAVE_FRIENDLY=0
+ fi
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*enable_foreign" ; then
+ HAVE_FOREIGN=0
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]]*\"\^\$\"" ; then
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"\.\*\"" ; then
+ HAVE_FOREIGN=1
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign" ; then
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"\^\$\"" ; then
+ HAVE_FOREIGN=2
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"NONE\"" ; then
+ HAVE_FOREIGN=2
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign" ; then
+ HAVE_FOREIGN=3
+ fi
+fi
+
+if [ "$HAVE_EXCEPTIONS" = "1" ]; then
+ if sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
+ if sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
+ HAVE_PROPERTY=1
+ elif sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
+ elif sed -n '/^blacklist_exceptions[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"" ; then
+ HAVE_PROPERTY=0
+ fi
+fi
@ -435,10 +439,10 @@ index 00000000..f34003c9
+ else
+ echo "multipath is disabled"
+ fi
+ if [ -z "$HAVE_FIND" -o "$HAVE_FIND" = 0 ]; then
+ echo "find_multipaths is disabled"
+ if [ -z "$HAVE_FIND" ]; then
+ echo "find_multipaths is no"
+ else
+ echo "find_multipaths is enabled"
+ echo "find_multipaths is $HAVE_FIND"
+ fi
+ if [ -z "$HAVE_FRIENDLY" -o "$HAVE_FRIENDLY" = 0 ]; then
+ echo "user_friendly_names is disabled"
@ -451,8 +455,10 @@ index 00000000..f34003c9
+ echo "default property blacklist is enabled"
+ fi
+ if [ -z "$HAVE_FOREIGN" -o "$HAVE_FOREIGN" = 0 ]; then
+ echo "enable_foreign is not set (all foreign multipath devices will be shown)"
+ echo "enable_foreign is not set (no foreign multipath devices will be shown)"
+ elif [ "$HAVE_FOREIGN" = 1 ]; then
+ echo "enable_foreign is set (all foreign multipath devices will be shown)"
+ elif [ "$HAVE_FOREIGN" = 2 ]; then
+ echo "enable_foreign is set (no foreign multipath devices will be shown)"
+ else
+ echo "enable_foreign is set (foreign multipath devices may not be shown)"
@ -497,14 +503,14 @@ index 00000000..f34003c9
+
+if [ "$ENABLE" = 2 ]; then
+ if [ "$HAVE_DISABLE" = 1 ]; then
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/# devnode ".*"/' $TMPFILE
+ fi
+ if [ -z "$HAVE_WWID_DISABLE" ]; then
+ sed -i '/^blacklist[[:space:]]*{/ a\
+ wwid ".*"
+' $TMPFILE
+ elif [ "$HAVE_WWID_DISABLE" = 0 ]; then
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid \"\.\?\*\"/ wwid ".*"/' $TMPFILE
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*wwid[[:space:]][[:space:]]*\"\.\?\*\"/ wwid ".*"/' $TMPFILE
+ fi
+ if [ "$HAVE_EXCEPTIONS" = 1 ]; then
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ {/^[[:space:]]*wwid/ d}' $TMPFILE
@ -518,7 +524,7 @@ index 00000000..f34003c9
+ add_blacklist_exceptions
+elif [ "$ENABLE" = 1 ]; then
+ if [ "$HAVE_DISABLE" = 1 ]; then
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode \"\.\?\*\"/# devnode ".*"/' $TMPFILE
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/# devnode ".*"/' $TMPFILE
+ fi
+elif [ "$ENABLE" = 0 ]; then
+ if [ -z "$HAVE_DISABLE" ]; then
@ -526,30 +532,25 @@ index 00000000..f34003c9
+ devnode ".*"
+' $TMPFILE
+ elif [ "$HAVE_DISABLE" = 0 ]; then
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode \"\.\?\*\"/ devnode ".*"/' $TMPFILE
+ sed -i '/^blacklist[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*devnode[[:space:]][[:space:]]*\"\.\?\*\"/ devnode ".*"/' $TMPFILE
+ fi
+fi
+
+if [ "$FIND" = "n" ]; then
+ if [ "$HAVE_FIND" = 1 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(yes\|1\)/ find_multipaths no/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+elif [ "$FIND" = "y" ]; then
+if [ -n "$FIND" ]; then
+ if [ -z "$HAVE_FIND" ]; then
+ sed -i '/^defaults[[:space:]]*{/ a\
+ find_multipaths yes
+ find_multipaths '"$FIND"'
+' $TMPFILE
+ CHANGED_CONFIG=1
+ elif [ "$HAVE_FIND" = 0 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*find_multipaths[[:space:]]*\(no\|0\)/ find_multipaths yes/' $TMPFILE
+ elif [ "$FIND" != "$HAVE_FIND" ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*[^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+fi
+
+if [ "$FRIENDLY" = "n" ]; then
+ if [ "$HAVE_FRIENDLY" = 1 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(yes\|1\)/ user_friendly_names no/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+elif [ "$FRIENDLY" = "y" ]; then
@ -559,14 +560,14 @@ index 00000000..f34003c9
+' $TMPFILE
+ CHANGED_CONFIG=1
+ elif [ "$HAVE_FRIENDLY" = 0 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)/ user_friendly_names yes/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+fi
+
+if [ "$PROPERTY" = "n" ]; then
+ if [ "$HAVE_PROPERTY" = 1 ]; then
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/# property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/# property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+elif [ "$PROPERTY" = "y" ]; then
@ -576,24 +577,24 @@ index 00000000..f34003c9
+' $TMPFILE
+ CHANGED_CONFIG=1
+ elif [ "$HAVE_PROPERTY" = 0 ]; then
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*property[[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/ property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
+ sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*#[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/ property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+fi
+
+if [ "$FOREIGN" = "y" ]; then
+ if [ "$HAVE_FOREIGN" = 1 -o "$HAVE_FOREIGN" = 2 ]; then
+if [ "$FOREIGN" = "n" ]; then
+ if [ "$HAVE_FOREIGN" = 1 -o "$HAVE_FOREIGN" = 3 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*enable_foreign/# enable_foreign/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+elif [ "$FOREIGN" = "n" ]; then
+elif [ "$FOREIGN" = "y" ]; then
+ if [ -z "$HAVE_FOREIGN" ]; then
+ sed -i '/^defaults[[:space:]]*{/ a\
+ enable_foreign "^$"
+ enable_foreign ".*"
+' $TMPFILE
+ CHANGED_CONFIG=1
+ elif [ "$HAVE_FOREIGN" = 0 -o "$HAVE_FOREIGN" = 2 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*#\?[[:space:]]*enable_foreign.*$/ enable_foreign "^$"/' $TMPFILE
+ elif [ "$HAVE_FOREIGN" = 0 -o "$HAVE_FOREIGN" = 2 -o "$HAVE_FOREIGN" = 3 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*#\?[[:space:]]*enable_foreign.*$/ enable_foreign ".*"/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+fi
@ -630,7 +631,7 @@ index 00000000..f34003c9
+fi
diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
new file mode 100644
index 00000000..b82961d6
index 00000000..a14d831e
--- /dev/null
+++ b/multipath/mpathconf.8
@@ -0,0 +1,135 @@
@ -674,9 +675,9 @@ index 00000000..b82961d6
+already exists, mpathconf will edit it. If it does not exist, mpathconf will
+create a default file with
+.B user_friendly_names
+and
+set and
+.B find_multipaths
+set. To disable these, use the
+set to \fByes\fP. To disable these, use the
+.B --user_friendly_names n
+and
+.B --find_multipaths n
@ -713,13 +714,13 @@ index 00000000..b82961d6
+defaults section. If set to \fBn\fP, this removes the line, if present. This
+command can be used along with any other command.
+.TP
+.B --find_multipaths\fP { \fBy\fP | \fBn\fP }
+If set to \fBy\fP, this adds the line
+.B find_multipaths yes
+.B --find_multipaths\fP { \fByes\fP | \fBno\fP | \fBstrict\fP | \fBgreedy\fP | \fBsmart\fP }
+If set to \fB<value>\fP, this adds the line
+.B find_multipaths <value>
+to the
+.B /etc/multipath.conf
+defaults section. If set to \fBn\fP, this removes the line, if present. This
+command can be used along with any other command.
+defaults section. This command can be used along with any other command.
+\fBy\fP and \fBn\fP can be used instead of \fByes\fP and \fBno\fP.
+.TP
+.B --property_blacklist \fP { \fBy\fP | \fBn\fP }
+If set to \fBy\fP, this adds the line
@ -730,11 +731,11 @@ index 00000000..b82961d6
+present. This command can be used along with any other command.
+.TP
+.B --enable_foreign\fP { \fBy\fP | \fBn\fP }
+If set to \fBn\fP, this adds the line
+.B enable_foreign "^$"
+If set to \fBy\fP, this adds the line
+.B enable_foreign ".*"
+to the
+.B /etc/multipath.conf
+defaults section. if set to \fBy\fP, this removes the line, if present. This
+defaults section. if set to \fBn\fP, this removes the line, if present. This
+command can be used along with any other command.
+.TP
+.B --outfile \fB<filename>\fP
@ -769,6 +770,3 @@ index 00000000..b82961d6
+.BR service (8),
+.SH AUTHOR
+Benjamin Marzinski <bmarzins@redhat.com>
--
2.17.2

View File

@ -14,23 +14,38 @@ multipathd.service
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/wwids.c | 44 +++++++++++++++++++++++++++++++++++
libmultipath/wwids.h | 1 +
multipath/main.c | 10 ++++++--
multipath/multipath.8 | 7 +++++-
multipath/main.c | 54 +++++++++++++++++++++++++++++++++--
multipath/multipath.8 | 7 ++++-
multipathd/multipathd.service | 1 +
5 files changed, 60 insertions(+), 3 deletions(-)
3 files changed, 59 insertions(+), 3 deletions(-)
diff --git a/libmultipath/wwids.c b/libmultipath/wwids.c
index 28a2150d..fab6fc8f 100644
--- a/libmultipath/wwids.c
+++ b/libmultipath/wwids.c
@@ -454,3 +454,47 @@ int op ## _wwid(const char *wwid) \
declare_failed_wwid_op(is_failed, false)
declare_failed_wwid_op(mark_failed, true)
declare_failed_wwid_op(unmark_failed, true)
+
+int remember_cmdline_wwid(void)
diff --git a/multipath/main.c b/multipath/main.c
index 65ece830..748e7902 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -122,7 +122,7 @@ usage (char * progname)
fprintf (stderr, " %s [-v level] [-R retries] -F\n", progname);
fprintf (stderr, " %s [-v level] [-l|-ll] [device]\n", progname);
fprintf (stderr, " %s [-v level] [-a|-w] device\n", progname);
- fprintf (stderr, " %s [-v level] -W\n", progname);
+ fprintf (stderr, " %s [-v level] [-A|-W]\n", progname);
fprintf (stderr, " %s [-v level] [-i] [-c|-C] device\n", progname);
fprintf (stderr, " %s [-v level] [-i] [-u|-U]\n", progname);
fprintf (stderr, " %s [-h|-t|-T]\n", progname);
@@ -136,6 +136,8 @@ usage (char * progname)
" -f flush a multipath device map\n"
" -F flush all multipath device maps\n"
" -a add a device wwid to the wwids file\n"
+ " -A add devices from kernel command line mpath.wwids\n"
+ " parameters to wwids file\n"
" -c check if a device should be a path in a multipath device\n"
" -C check if a multipath device has usable paths\n"
" -q allow queue_if_no_path when multipathd is not running\n"
@@ -450,6 +452,50 @@ static void cleanup_vecs(void)
free_pathvec(vecs.pathvec, FREE_PATHS);
}
+static int remember_cmdline_wwid(void)
+{
+ FILE *f = NULL;
+ char buf[LINE_MAX], *next, *ptr;
@ -73,50 +88,20 @@ index 28a2150d..fab6fc8f 100644
+ }
+ return ret;
+}
diff --git a/libmultipath/wwids.h b/libmultipath/wwids.h
index 0c6ee54d..e32a0b0e 100644
--- a/libmultipath/wwids.h
+++ b/libmultipath/wwids.h
@@ -17,6 +17,7 @@ int remember_wwid(char *wwid);
int check_wwids_file(char *wwid, int write_wwid);
int remove_wwid(char *wwid);
int replace_wwids(vector mp);
+int remember_cmdline_wwid(void);
enum {
WWID_IS_NOT_FAILED = 0,
diff --git a/multipath/main.c b/multipath/main.c
index cf9d2a28..78822ee1 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -138,7 +138,7 @@ usage (char * progname)
fprintf (stderr, " %s [-v level] [-R retries] -F\n", progname);
fprintf (stderr, " %s [-v level] [-l|-ll] [device]\n", progname);
fprintf (stderr, " %s [-v level] [-a|-w] device\n", progname);
- fprintf (stderr, " %s [-v level] -W\n", progname);
+ fprintf (stderr, " %s [-v level] [-A|-W]\n", progname);
fprintf (stderr, " %s [-v level] [-i] [-c|-C] device\n", progname);
fprintf (stderr, " %s [-v level] [-i] [-u|-U]\n", progname);
fprintf (stderr, " %s [-h|-t|-T]\n", progname);
@@ -151,6 +151,8 @@ usage (char * progname)
" -f flush a multipath device map\n"
" -F flush all multipath device maps\n"
" -a add a device wwid to the wwids file\n"
+ " -A add devices from kernel command line mpath.wwids\n"
+ " parameters to wwids file\n"
" -c check if a device should be a path in a multipath device\n"
" -C check if a multipath device has usable paths\n"
" -q allow queue_if_no_path when multipathd is not running\n"
@@ -907,7 +909,7 @@ main (int argc, char *argv[])
multipath_conf = conf;
+
static int
configure (struct config *conf, enum mpath_cmds cmd,
enum devtypes dev_type, char *devpath)
@@ -838,7 +884,7 @@ main (int argc, char *argv[])
conf->retrigger_tries = 0;
conf->force_sync = 1;
- while ((arg = getopt(argc, argv, ":adcChl::FfM:v:p:b:BrR:itTquUwW")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":aAdcChl::FfM:v:p:b:BrR:itTquUwW")) != EOF ) {
atexit(cleanup_vecs);
- while ((arg = getopt(argc, argv, ":adDcChl::eFfM:v:p:b:BrR:itTquUwW")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":aAdDcChl::eFfM:v:p:b:BrR:itTquUwW")) != EOF ) {
switch(arg) {
case 1: printf("optarg : %s\n",optarg);
break;
@@ -977,6 +979,10 @@ main (int argc, char *argv[])
@@ -915,6 +961,10 @@ main (int argc, char *argv[])
case 'T':
cmd = CMD_DUMP_CONFIG;
break;
@ -128,7 +113,7 @@ index cf9d2a28..78822ee1 100644
usage(argv[0]);
exit(RTVL_OK);
diff --git a/multipath/multipath.8 b/multipath/multipath.8
index 9cdd05a3..8befc45a 100644
index 17df59f5..5ca75359 100644
--- a/multipath/multipath.8
+++ b/multipath/multipath.8
@@ -63,7 +63,7 @@ multipath \- Device mapper target autoconfig.
@ -153,10 +138,10 @@ index 9cdd05a3..8befc45a 100644
Remove the WWID for the specified device from the WWIDs file.
.
diff --git a/multipathd/multipathd.service b/multipathd/multipathd.service
index 17434cef..0fbcc46b 100644
index 6d57c7e8..dfc1e962 100644
--- a/multipathd/multipathd.service
+++ b/multipathd/multipathd.service
@@ -15,6 +15,7 @@ Type=notify
@@ -16,6 +16,7 @@ Type=notify
NotifyAccess=main
LimitCORE=infinity
ExecStartPre=-/sbin/modprobe -a scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm-multipath
@ -164,6 +149,3 @@ index 17434cef..0fbcc46b 100644
ExecStart=/sbin/multipathd -d -s
ExecReload=/sbin/multipathd reconfigure
TasksMax=infinity
--
2.17.2

View File

@ -12,10 +12,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index e5ee6afe..52fe05b9 100644
index c27946c7..e0dd32ad 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -22,7 +22,7 @@
@@ -23,7 +23,7 @@
#define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF
#define DEFAULT_VERBOSITY 2
#define DEFAULT_REASSIGN_MAPS 0
@ -24,6 +24,3 @@ index e5ee6afe..52fe05b9 100644
#define DEFAULT_FAST_IO_FAIL 5
#define DEFAULT_DEV_LOSS_TMO 600
#define DEFAULT_RETAIN_HWHANDLER RETAIN_HWHANDLER_ON
--
2.17.2

View File

@ -82,6 +82,3 @@ index b5c7873d..e139360c 100644
switch (rc) {
case NVME_ANA_OPTIMIZED:
--
2.17.2

View File

@ -0,0 +1,102 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 25 Mar 2021 13:05:10 -0500
Subject: [PATCH] RH: make parse_vpd_pg83 match scsi_id output
Red Hat sets ID_SERIAL based on the result of scsi_id, instead of using
the result of sg_inq and 55-scsi-sg3_id.rules. Make parse_vpd_pg83 match
that.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 18 ++----------------
tests/vpd.c | 6 ++++++
2 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index f25fe9e3..6fb81c28 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1136,12 +1136,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
naa_prio = 7;
break;
case 2:
- /* IEEE Extended: Prio 6 */
- naa_prio = 6;
- break;
case 3:
- /* IEEE Locally assigned: Prio 1 */
- naa_prio = 1;
+ /* IEEE Extended or Locally assigned: Prio 6 */
+ naa_prio = 6;
break;
default:
/* Default: no priority */
@@ -1160,17 +1157,6 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
vpd = d;
}
break;
- case 0x8:
- /* SCSI Name: Prio 3 */
- if (memcmp(d + 4, "eui.", 4) &&
- memcmp(d + 4, "naa.", 4) &&
- memcmp(d + 4, "iqn.", 4))
- break;
- if (prio < 3) {
- prio = 3;
- vpd = d;
- }
- break;
case 0x1:
/* T-10 Vendor ID: Prio 2 */
if (prio < 2) {
diff --git a/tests/vpd.c b/tests/vpd.c
index 8e730d37..7bf7990f 100644
--- a/tests/vpd.c
+++ b/tests/vpd.c
@@ -230,11 +230,13 @@ static const char * const str_prefix[] = {
[STR_IQN] = "iqn.",
};
+#if 0
static const char byte0[] = {
[STR_EUI] = '2',
[STR_NAA] = '3',
[STR_IQN] = '8',
};
+#endif
/**
* create_scsi_string_desc() - create a SCSI name string descriptor.
@@ -659,6 +661,7 @@ make_test_vpd_naa(2, 18);
make_test_vpd_naa(2, 17);
make_test_vpd_naa(2, 16);
+#if 0
/* SCSI Name string: EUI64, WWID size: 17 */
make_test_vpd_str(0, 20, 18)
make_test_vpd_str(0, 20, 17)
@@ -694,6 +697,7 @@ make_test_vpd_str(18, 20, 18)
make_test_vpd_str(18, 20, 17)
make_test_vpd_str(18, 20, 16)
make_test_vpd_str(18, 20, 15)
+#endif
static int test_vpd(void)
{
@@ -767,6 +771,7 @@ static int test_vpd(void)
cmocka_unit_test(test_vpd_naa_2_18),
cmocka_unit_test(test_vpd_naa_2_17),
cmocka_unit_test(test_vpd_naa_2_16),
+/*
cmocka_unit_test(test_vpd_str_0_20_18),
cmocka_unit_test(test_vpd_str_0_20_17),
cmocka_unit_test(test_vpd_str_0_20_16),
@@ -791,6 +796,7 @@ static int test_vpd(void)
cmocka_unit_test(test_vpd_str_18_20_17),
cmocka_unit_test(test_vpd_str_18_20_16),
cmocka_unit_test(test_vpd_str_18_20_15),
+*/
};
return cmocka_run_group_tests(tests, setup, teardown);
}

View File

@ -1,37 +1,36 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 23 Sep 2021 14:16:51 -0500
Subject: [PATCH] libmulitpath: add section name to invalid keyword output
Subject: [PATCH] libmultipath: add section name to invalid keyword output
If users forget the closing brace for a section in multipath.conf,
multipath has no way to detect that. When it sees the keyword at the
start of the next section, it will complain that there is an invalid
keyword, because that keyword doesn't belong in previous section (which
was never ended with a closing brace). This can confuse users. To make
this easier to understand, when multipath prints and invalid keyword
this easier to understand, when multipath prints an invalid keyword
message, it now also prints the current section name, which can give
users a hint that they didn't end the previous section.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/parser.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
libmultipath/parser.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index 48b54e87..96b95936 100644
index 8ca91bf2..611054f7 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -507,7 +507,8 @@ validate_config_strvec(vector strvec, char *file)
}
@@ -504,7 +504,7 @@ validate_config_strvec(vector strvec, const char *file)
static int
-process_stream(struct config *conf, FILE *stream, vector keywords, char *file)
+process_stream(struct config *conf, FILE *stream, vector keywords,
+ const char *section, char *file)
process_stream(struct config *conf, FILE *stream, vector keywords,
- const char *file)
+ const char *section, const char *file)
{
int i;
int r = 0, t;
@@ -571,16 +572,22 @@ process_stream(struct config *conf, FILE *stream, vector keywords, char *file)
@@ -568,16 +568,22 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
if (keyword->sub) {
kw_level++;
r += process_stream(conf, stream,
@ -59,7 +58,7 @@ index 48b54e87..96b95936 100644
free_strvec(strvec);
}
if (kw_level == 1)
@@ -611,7 +618,7 @@ process_file(struct config *conf, char *file)
@@ -608,7 +614,7 @@ process_file(struct config *conf, const char *file)
/* Stream handling */
line_nr = 0;

View File

@ -1,44 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 23 Sep 2021 21:39:36 -0500
Subject: [PATCH] libmultipath: use typedef for keyword handler and print
functions
Subject: [PATCH] libmultipath: use typedef for keyword handler function
Don't keep writing out the function type.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/parser.c | 10 +++++-----
libmultipath/parser.h | 25 ++++++++++++-------------
2 files changed, 17 insertions(+), 18 deletions(-)
libmultipath/parser.c | 6 +++---
libmultipath/parser.h | 15 ++++++---------
2 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index 96b95936..e511acf9 100644
index 611054f7..ebe1cbd9 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -32,8 +32,8 @@ static int line_nr;
@@ -33,7 +33,7 @@ static int line_nr;
int
keyword_alloc(vector keywords, char *string,
- int (*handler) (struct config *, vector),
- int (*print) (struct config *, char *, int, const void*),
+ handler_fn *handler,
+ print_fn *print,
print_fn *print,
int unique)
{
struct keyword *keyword;
@@ -71,8 +71,8 @@ install_sublevel_end(void)
@@ -72,7 +72,7 @@ install_sublevel_end(void)
int
_install_keyword(vector keywords, char *string,
- int (*handler) (struct config *, vector),
- int (*print) (struct config *, char *, int, const void*),
+ handler_fn *handler,
+ print_fn *print,
print_fn *print,
int unique)
{
int i = 0;
@@ -562,7 +562,7 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
@@ -558,7 +558,7 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
goto out;
}
if (keyword->handler) {
@ -48,48 +43,40 @@ index 96b95936..e511acf9 100644
if (t)
condlog(1, "multipath.conf +%d, parsing failed: %s",
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
index b7917052..e8d89607 100644
index b43d46f8..3452bde1 100644
--- a/libmultipath/parser.h
+++ b/libmultipath/parser.h
@@ -39,11 +39,15 @@
#define EOB "}"
#define MAXBUF 1024
@@ -43,10 +43,11 @@ struct strbuf;
-/* ketword definition */
+
+/* keyword definition */
+typedef int print_fn(struct config *, char *, int, const void *);
/* keyword definition */
typedef int print_fn(struct config *, struct strbuf *, const void *);
+typedef int handler_fn(struct config *, vector);
+
struct keyword {
char *string;
- int (*handler) (struct config *, vector);
- int (*print) (struct config *, char *, int, const void *);
+ handler_fn *handler;
+ print_fn *print;
print_fn *print;
vector sub;
int unique;
};
@@ -58,19 +62,14 @@ struct keyword {
@@ -62,18 +63,14 @@ struct keyword {
for (i = 0; i < (k)->sub->allocated && ((p) = (k)->sub->slot[i]); i++)
/* Prototypes */
-extern int keyword_alloc(vector keywords, char *string,
- int (*handler) (struct config *, vector),
- int (*print) (struct config *, char *, int,
- const void *),
- print_fn *print,
- int unique);
+extern int keyword_alloc(vector keywords, char *string, handler_fn *handler,
+ print_fn *print, int unique);
#define install_keyword_root(str, h) keyword_alloc(keywords, str, h, NULL, 1)
extern void install_sublevel(void);
extern void install_sublevel_end(void);
-extern int _install_keyword(vector keywords, char *string,
- int (*handler) (struct config *, vector),
- int (*print) (struct config *, char *, int,
- const void *),
- print_fn *print,
- int unique);
+
+extern int _install_keyword(vector keywords, char *string, handler_fn *handler,
+ print_fn *print, int unique);
#define install_keyword(str, vec, pri) _install_keyword(keywords, str, vec, pri, 1)

View File

@ -11,10 +11,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index e511acf9..341f2b80 100644
index ebe1cbd9..d5595fb0 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -565,8 +565,8 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
@@ -561,8 +561,8 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
t = keyword->handler(conf, strvec);
r += t;
if (t)

View File

@ -8,17 +8,17 @@ warning messages. It will be used by future patches.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dict.c | 145 +++++++++++++++++++++++++-----------------
libmultipath/dict.c | 143 +++++++++++++++++++++++++-----------------
libmultipath/parser.c | 3 +-
libmultipath/parser.h | 2 +-
3 files changed, 91 insertions(+), 59 deletions(-)
3 files changed, 90 insertions(+), 58 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 13698b76..a8872da7 100644
index 7a727389..eb2c44c0 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -28,7 +28,7 @@
#include "dict.h"
@@ -29,7 +29,7 @@
#include "strbuf.h"
static int
-set_int(vector strvec, void *ptr)
@ -26,7 +26,7 @@ index 13698b76..a8872da7 100644
{
int *int_ptr = (int *)ptr;
char *buff, *eptr;
@@ -57,7 +57,7 @@ set_int(vector strvec, void *ptr)
@@ -58,7 +58,7 @@ set_int(vector strvec, void *ptr)
}
static int
@ -35,7 +35,7 @@ index 13698b76..a8872da7 100644
{
unsigned int *uint_ptr = (unsigned int *)ptr;
char *buff, *eptr, *p;
@@ -89,7 +89,7 @@ set_uint(vector strvec, void *ptr)
@@ -90,7 +90,7 @@ set_uint(vector strvec, void *ptr)
}
static int
@ -44,16 +44,7 @@ index 13698b76..a8872da7 100644
{
char **str_ptr = (char **)ptr;
@@ -104,7 +104,7 @@ set_str(vector strvec, void *ptr)
}
static int
-set_regex(vector strvec, void *ptr)
+set_regex(vector strvec, void *ptr, const char *file, int line_nr)
{
char **str_ptr = (char **)ptr;
@@ -119,7 +119,7 @@ set_regex(vector strvec, void *ptr)
@@ -105,7 +105,7 @@ set_str(vector strvec, void *ptr)
}
static int
@ -62,7 +53,7 @@ index 13698b76..a8872da7 100644
{
char * buff;
int *int_ptr = (int *)ptr;
@@ -138,7 +138,7 @@ set_yes_no(vector strvec, void *ptr)
@@ -124,7 +124,7 @@ set_yes_no(vector strvec, void *ptr)
}
static int
@ -71,7 +62,7 @@ index 13698b76..a8872da7 100644
{
char * buff;
int *int_ptr = (int *)ptr;
@@ -240,9 +240,10 @@ print_yes_no_undef (char *buff, int len, long v)
@@ -187,9 +187,10 @@ static int print_yes_no_undef(struct strbuf *buff, long v)
#define declare_def_handler(option, function) \
static int \
@ -84,7 +75,7 @@ index 13698b76..a8872da7 100644
}
#define declare_def_snprint(option, function) \
@@ -277,12 +278,13 @@ snprint_def_ ## option (struct config *conf, char * buff, int len, \
@@ -224,12 +225,13 @@ snprint_def_ ## option (struct config *conf, struct strbuf *buff, \
#define declare_hw_handler(option, function) \
static int \
@ -100,7 +91,7 @@ index 13698b76..a8872da7 100644
}
#define declare_hw_snprint(option, function) \
@@ -296,11 +298,12 @@ snprint_hw_ ## option (struct config *conf, char * buff, int len, \
@@ -243,11 +245,12 @@ snprint_hw_ ## option (struct config *conf, struct strbuf *buff, \
#define declare_ovr_handler(option, function) \
static int \
@ -115,7 +106,7 @@ index 13698b76..a8872da7 100644
}
#define declare_ovr_snprint(option, function) \
@@ -313,12 +316,13 @@ snprint_ovr_ ## option (struct config *conf, char * buff, int len, \
@@ -260,12 +263,13 @@ snprint_ovr_ ## option (struct config *conf, struct strbuf *buff, \
#define declare_mp_handler(option, function) \
static int \
@ -131,8 +122,8 @@ index 13698b76..a8872da7 100644
}
#define declare_mp_snprint(option, function) \
@@ -330,9 +334,10 @@ snprint_mp_ ## option (struct config *conf, char * buff, int len, \
return function (buff, len, mpe->option); \
@@ -277,9 +281,10 @@ snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \
return function(buff, mpe->option); \
}
-static int checkint_handler(struct config *conf, vector strvec)
@ -144,7 +135,7 @@ index 13698b76..a8872da7 100644
if (rc)
return rc;
@@ -355,9 +360,10 @@ declare_def_snprint(reassign_maps, print_yes_no)
@@ -302,9 +307,10 @@ declare_def_snprint(reassign_maps, print_yes_no)
declare_def_handler(multipath_dir, set_str)
declare_def_snprint(multipath_dir, print_str)
@ -157,7 +148,7 @@ index 13698b76..a8872da7 100644
if (rc != 0)
return rc;
@@ -387,13 +393,13 @@ static const char * const find_multipaths_optvals[] = {
@@ -334,13 +340,13 @@ static const char * const find_multipaths_optvals[] = {
};
static int
@ -174,8 +165,8 @@ index 13698b76..a8872da7 100644
return 0;
buff = set_value(strvec);
@@ -451,7 +457,8 @@ static int snprint_uid_attrs(struct config *conf, char *buff, int len,
return p - buff;
@@ -396,7 +402,8 @@ static int snprint_uid_attrs(struct config *conf, struct strbuf *buff,
return total;
}
-static int uid_attrs_handler(struct config *conf, vector strvec)
@ -184,7 +175,7 @@ index 13698b76..a8872da7 100644
{
char *val;
@@ -644,7 +651,8 @@ declare_hw_handler(skip_kpartx, set_yes_no_undef)
@@ -597,7 +604,8 @@ declare_hw_handler(skip_kpartx, set_yes_no_undef)
declare_hw_snprint(skip_kpartx, print_yes_no_undef)
declare_mp_handler(skip_kpartx, set_yes_no_undef)
declare_mp_snprint(skip_kpartx, print_yes_no_undef)
@ -194,7 +185,7 @@ index 13698b76..a8872da7 100644
{
return 0;
}
@@ -675,20 +683,23 @@ declare_def_snprint_defstr(enable_foreign, print_str,
@@ -629,20 +637,23 @@ declare_def_snprint_defstr(enable_foreign, print_str,
DEFAULT_ENABLE_FOREIGN)
static int
@ -222,7 +213,7 @@ index 13698b76..a8872da7 100644
}
#define declare_def_attr_snprint(option, function) \
@@ -702,12 +713,14 @@ snprint_def_ ## option (struct config *conf, char * buff, int len, \
@@ -655,12 +666,14 @@ snprint_def_ ## option (struct config *conf, struct strbuf *buff, \
#define declare_mp_attr_handler(option, function) \
static int \
@ -239,7 +230,7 @@ index 13698b76..a8872da7 100644
}
#define declare_mp_attr_snprint(option, function) \
@@ -721,7 +734,7 @@ snprint_mp_ ## option (struct config *conf, char * buff, int len, \
@@ -673,7 +686,7 @@ snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \
}
static int
@ -248,7 +239,7 @@ index 13698b76..a8872da7 100644
{
mode_t mode;
mode_t *mode_ptr = (mode_t *)ptr;
@@ -742,7 +755,7 @@ set_mode(vector strvec, void *ptr, int *flags)
@@ -694,7 +707,7 @@ set_mode(vector strvec, void *ptr, int *flags)
}
static int
@ -257,7 +248,7 @@ index 13698b76..a8872da7 100644
{
uid_t uid;
uid_t *uid_ptr = (uid_t *)ptr;
@@ -767,7 +780,7 @@ set_uid(vector strvec, void *ptr, int *flags)
@@ -719,7 +732,7 @@ set_uid(vector strvec, void *ptr, int *flags)
}
static int
@ -266,7 +257,7 @@ index 13698b76..a8872da7 100644
{
gid_t gid;
gid_t *gid_ptr = (gid_t *)ptr;
@@ -834,7 +847,7 @@ declare_mp_attr_handler(gid, set_gid)
@@ -786,7 +799,7 @@ declare_mp_attr_handler(gid, set_gid)
declare_mp_attr_snprint(gid, print_gid)
static int
@ -275,7 +266,7 @@ index 13698b76..a8872da7 100644
{
char * buff;
int *int_ptr = (int *)ptr;
@@ -876,7 +889,7 @@ declare_hw_handler(fast_io_fail, set_undef_off_zero)
@@ -827,7 +840,7 @@ declare_hw_handler(fast_io_fail, set_undef_off_zero)
declare_hw_snprint(fast_io_fail, print_undef_off_zero)
static int
@ -284,7 +275,7 @@ index 13698b76..a8872da7 100644
{
char * buff;
unsigned int *uint_ptr = (unsigned int *)ptr;
@@ -919,7 +932,7 @@ declare_hw_handler(eh_deadline, set_undef_off_zero)
@@ -870,7 +883,7 @@ declare_hw_handler(eh_deadline, set_undef_off_zero)
declare_hw_snprint(eh_deadline, print_undef_off_zero)
static int
@ -293,7 +284,7 @@ index 13698b76..a8872da7 100644
{
char * buff;
int *int_ptr = (int *)ptr;
@@ -985,7 +998,8 @@ get_sys_max_fds(int *max_fds)
@@ -936,7 +949,8 @@ get_sys_max_fds(int *max_fds)
static int
@ -303,7 +294,7 @@ index 13698b76..a8872da7 100644
{
char * buff;
int r = 0, max_fds;
@@ -1030,7 +1044,7 @@ snprint_max_fds (struct config *conf, char * buff, int len, const void * data)
@@ -981,7 +995,7 @@ snprint_max_fds (struct config *conf, struct strbuf *buff, const void *data)
}
static int
@ -312,7 +303,7 @@ index 13698b76..a8872da7 100644
{
int *int_ptr = (int *)ptr;
char * buff;
@@ -1074,7 +1088,7 @@ declare_mp_handler(rr_weight, set_rr_weight)
@@ -1025,7 +1039,7 @@ declare_mp_handler(rr_weight, set_rr_weight)
declare_mp_snprint(rr_weight, print_rr_weight)
static int
@ -321,7 +312,7 @@ index 13698b76..a8872da7 100644
{
int *int_ptr = (int *)ptr;
char * buff;
@@ -1124,7 +1138,7 @@ declare_mp_handler(pgfailback, set_pgfailback)
@@ -1075,7 +1089,7 @@ declare_mp_handler(pgfailback, set_pgfailback)
declare_mp_snprint(pgfailback, print_pgfailback)
static int
@ -330,7 +321,7 @@ index 13698b76..a8872da7 100644
{
int *int_ptr = (int *)ptr;
char * buff;
@@ -1169,7 +1183,8 @@ declare_mp_handler(no_path_retry, no_path_retry_helper)
@@ -1120,7 +1134,8 @@ declare_mp_handler(no_path_retry, no_path_retry_helper)
declare_mp_snprint(no_path_retry, print_no_path_retry)
static int
@ -340,7 +331,7 @@ index 13698b76..a8872da7 100644
{
char * buff;
@@ -1243,7 +1258,8 @@ print_reservation_key(char * buff, int len, struct be64 key, uint8_t flags,
@@ -1193,7 +1208,8 @@ print_reservation_key(struct strbuf *buff,
}
static int
@ -350,7 +341,7 @@ index 13698b76..a8872da7 100644
{
return set_reservation_key(strvec, &conf->reservation_key,
&conf->sa_flags,
@@ -1260,7 +1276,8 @@ snprint_def_reservation_key (struct config *conf, char * buff, int len,
@@ -1209,7 +1225,8 @@ snprint_def_reservation_key (struct config *conf, struct strbuf *buff,
}
static int
@ -360,7 +351,7 @@ index 13698b76..a8872da7 100644
{
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable);
if (!mpe)
@@ -1281,7 +1298,7 @@ snprint_mp_reservation_key (struct config *conf, char * buff, int len,
@@ -1229,7 +1246,7 @@ snprint_mp_reservation_key (struct config *conf, struct strbuf *buff,
}
static int
@ -369,7 +360,7 @@ index 13698b76..a8872da7 100644
{
int *int_ptr = (int *)ptr;
char * buff;
@@ -1422,7 +1439,8 @@ declare_hw_snprint(recheck_wwid, print_yes_no_undef)
@@ -1370,7 +1387,8 @@ declare_hw_snprint(recheck_wwid, print_yes_no_undef)
static int
@ -379,7 +370,7 @@ index 13698b76..a8872da7 100644
{
unsigned int uxsock_timeout;
char *buff;
@@ -1442,7 +1460,8 @@ def_uxsock_timeout_handler(struct config *conf, vector strvec)
@@ -1390,7 +1408,8 @@ def_uxsock_timeout_handler(struct config *conf, vector strvec)
}
static int
@ -389,7 +380,7 @@ index 13698b76..a8872da7 100644
{
int i;
char *buff;
@@ -1482,7 +1501,8 @@ snprint_hw_vpd_vendor(struct config *conf, char * buff, int len,
@@ -1430,7 +1449,8 @@ snprint_hw_vpd_vendor(struct config *conf, struct strbuf *buff,
* blacklist block handlers
*/
static int
@ -399,7 +390,7 @@ index 13698b76..a8872da7 100644
{
if (!conf->blist_devnode)
conf->blist_devnode = vector_alloc();
@@ -1504,7 +1524,8 @@ blacklist_handler(struct config *conf, vector strvec)
@@ -1452,7 +1472,8 @@ blacklist_handler(struct config *conf, vector strvec)
}
static int
@ -409,7 +400,7 @@ index 13698b76..a8872da7 100644
{
if (!conf->elist_devnode)
conf->elist_devnode = vector_alloc();
@@ -1527,7 +1548,8 @@ blacklist_exceptions_handler(struct config *conf, vector strvec)
@@ -1475,7 +1496,8 @@ blacklist_exceptions_handler(struct config *conf, vector strvec)
#define declare_ble_handler(option) \
static int \
@ -417,9 +408,9 @@ index 13698b76..a8872da7 100644
+ble_ ## option ## _handler (struct config *conf, vector strvec, \
+ const char *file, int line_nr) \
{ \
char * buff; \
\
@@ -1543,7 +1565,8 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
char *buff; \
int rc; \
@@ -1494,7 +1516,8 @@ ble_ ## option ## _handler (struct config *conf, vector strvec) \
#define declare_ble_device_handler(name, option, vend, prod) \
static int \
@ -428,8 +419,8 @@ index 13698b76..a8872da7 100644
+ const char *file, int line_nr) \
{ \
char * buff; \
\
@@ -1583,13 +1606,15 @@ snprint_ble_simple (struct config *conf, char * buff, int len,
int rc; \
@@ -1536,13 +1559,15 @@ snprint_ble_simple (struct config *conf, struct strbuf *buff, const void *data)
}
static int
@ -447,7 +438,7 @@ index 13698b76..a8872da7 100644
{
return alloc_ble_device(conf->elist_device);
}
@@ -1623,7 +1648,8 @@ snprint_bled_product (struct config *conf, char * buff, int len,
@@ -1574,7 +1599,8 @@ static int snprint_bled_product(struct config *conf, struct strbuf *buff,
* devices block handlers
*/
static int
@ -457,7 +448,7 @@ index 13698b76..a8872da7 100644
{
if (!conf->hwtable)
conf->hwtable = vector_alloc();
@@ -1635,7 +1661,8 @@ devices_handler(struct config *conf, vector strvec)
@@ -1586,7 +1612,8 @@ devices_handler(struct config *conf, vector strvec)
}
static int
@ -467,7 +458,7 @@ index 13698b76..a8872da7 100644
{
struct hwentry * hwe;
@@ -1672,7 +1699,8 @@ declare_hw_snprint(hwhandler, print_str)
@@ -1623,7 +1650,8 @@ declare_hw_snprint(hwhandler, print_str)
* overrides handlers
*/
static int
@ -477,7 +468,7 @@ index 13698b76..a8872da7 100644
{
if (!conf->overrides)
conf->overrides = alloc_hwe();
@@ -1689,7 +1717,8 @@ overrides_handler(struct config *conf, vector strvec)
@@ -1640,7 +1668,8 @@ overrides_handler(struct config *conf, vector strvec)
* multipaths block handlers
*/
static int
@ -487,7 +478,7 @@ index 13698b76..a8872da7 100644
{
if (!conf->mptable)
conf->mptable = vector_alloc();
@@ -1701,7 +1730,8 @@ multipaths_handler(struct config *conf, vector strvec)
@@ -1652,7 +1681,8 @@ multipaths_handler(struct config *conf, vector strvec)
}
static int
@ -497,7 +488,7 @@ index 13698b76..a8872da7 100644
{
struct mpentry * mpe;
@@ -1730,7 +1760,8 @@ declare_mp_snprint(alias, print_str)
@@ -1681,7 +1711,8 @@ declare_mp_snprint(alias, print_str)
*/
static int
@ -508,10 +499,10 @@ index 13698b76..a8872da7 100644
char * buff;
diff --git a/libmultipath/parser.c b/libmultipath/parser.c
index 341f2b80..29e8cee0 100644
index d5595fb0..68262d0e 100644
--- a/libmultipath/parser.c
+++ b/libmultipath/parser.c
@@ -562,7 +562,8 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
@@ -558,7 +558,8 @@ process_stream(struct config *conf, FILE *stream, vector keywords,
goto out;
}
if (keyword->handler) {
@ -522,13 +513,13 @@ index 341f2b80..29e8cee0 100644
if (t)
condlog(1, "%s line %d, parsing failed: %s",
diff --git a/libmultipath/parser.h b/libmultipath/parser.h
index e8d89607..8b424b7a 100644
index 3452bde1..11ea2278 100644
--- a/libmultipath/parser.h
+++ b/libmultipath/parser.h
@@ -42,7 +42,7 @@
@@ -43,7 +43,7 @@ struct strbuf;
/* keyword definition */
typedef int print_fn(struct config *, char *, int, const void *);
typedef int print_fn(struct config *, struct strbuf *, const void *);
-typedef int handler_fn(struct config *, vector);
+typedef int handler_fn(struct config *, vector, const char *file, int line_nr);

View File

@ -12,11 +12,11 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 75 insertions(+), 46 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index a8872da7..686f4d5c 100644
index eb2c44c0..57b6a7b6 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -28,7 +28,8 @@
#include "dict.h"
@@ -29,7 +29,8 @@
#include "strbuf.h"
static int
-set_int(vector strvec, void *ptr, const char *file, int line_nr)
@ -25,7 +25,7 @@ index a8872da7..686f4d5c 100644
{
int *int_ptr = (int *)ptr;
char *buff, *eptr;
@@ -43,11 +44,17 @@ set_int(vector strvec, void *ptr, const char *file, int line_nr)
@@ -44,11 +45,17 @@ set_int(vector strvec, void *ptr, const char *file, int line_nr)
if (eptr > buff)
while (isspace(*eptr))
eptr++;
@ -46,7 +46,7 @@ index a8872da7..686f4d5c 100644
rc = 0;
*int_ptr = res;
}
@@ -76,8 +83,8 @@ set_uint(vector strvec, void *ptr, const char *file, int line_nr)
@@ -77,8 +84,8 @@ set_uint(vector strvec, void *ptr, const char *file, int line_nr)
while (isspace(*eptr))
eptr++;
if (*buff == '\0' || *eptr != '\0' || !isdigit(*p) || res > UINT_MAX) {
@ -57,7 +57,7 @@ index a8872da7..686f4d5c 100644
rc = 1;
} else {
rc = 0;
@@ -246,6 +253,14 @@ def_ ## option ## _handler (struct config *conf, vector strvec, \
@@ -193,6 +200,14 @@ def_ ## option ## _handler (struct config *conf, vector strvec, \
return function (strvec, &conf->option, file, line_nr); \
}
@ -71,8 +71,8 @@ index a8872da7..686f4d5c 100644
+
#define declare_def_snprint(option, function) \
static int \
snprint_def_ ## option (struct config *conf, char * buff, int len, \
@@ -287,6 +302,18 @@ hw_ ## option ## _handler (struct config *conf, vector strvec, \
snprint_def_ ## option (struct config *conf, struct strbuf *buff, \
@@ -234,6 +249,18 @@ hw_ ## option ## _handler (struct config *conf, vector strvec, \
return function (strvec, &hwe->option, file, line_nr); \
}
@ -90,8 +90,8 @@ index a8872da7..686f4d5c 100644
+
#define declare_hw_snprint(option, function) \
static int \
snprint_hw_ ## option (struct config *conf, char * buff, int len, \
@@ -306,6 +333,17 @@ ovr_ ## option ## _handler (struct config *conf, vector strvec, \
snprint_hw_ ## option (struct config *conf, struct strbuf *buff, \
@@ -253,6 +280,17 @@ ovr_ ## option ## _handler (struct config *conf, vector strvec, \
return function (strvec, &conf->overrides->option, file, line_nr); \
}
@ -108,8 +108,8 @@ index a8872da7..686f4d5c 100644
+
#define declare_ovr_snprint(option, function) \
static int \
snprint_ovr_ ## option (struct config *conf, char * buff, int len, \
@@ -325,6 +363,17 @@ mp_ ## option ## _handler (struct config *conf, vector strvec, \
snprint_ovr_ ## option (struct config *conf, struct strbuf *buff, \
@@ -272,6 +310,17 @@ mp_ ## option ## _handler (struct config *conf, vector strvec, \
return function (strvec, &mpe->option, file, line_nr); \
}
@ -126,8 +126,8 @@ index a8872da7..686f4d5c 100644
+
#define declare_mp_snprint(option, function) \
static int \
snprint_mp_ ## option (struct config *conf, char * buff, int len, \
@@ -351,7 +400,7 @@ declare_def_snprint(checkint, print_int)
snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \
@@ -298,7 +347,7 @@ declare_def_snprint(checkint, print_int)
declare_def_handler(max_checkint, set_uint)
declare_def_snprint(max_checkint, print_int)
@ -136,7 +136,7 @@ index a8872da7..686f4d5c 100644
declare_def_snprint(verbosity, print_int)
declare_def_handler(reassign_maps, set_yes_no)
@@ -528,22 +577,22 @@ declare_ovr_snprint(checker_name, print_str)
@@ -473,22 +522,22 @@ declare_ovr_snprint(checker_name, print_str)
declare_hw_handler(checker_name, set_str)
declare_hw_snprint(checker_name, print_str)
@ -167,16 +167,16 @@ index a8872da7..686f4d5c 100644
declare_mp_snprint(minio_rq, print_nonzero)
declare_def_handler(queue_without_daemon, set_yes_no)
@@ -562,7 +611,7 @@ snprint_def_queue_without_daemon (struct config *conf,
return 0;
@@ -512,7 +561,7 @@ snprint_def_queue_without_daemon(struct config *conf, struct strbuf *buff,
return append_strbuf_quoted(buff, qwd);
}
-declare_def_handler(checker_timeout, set_int)
+declare_def_range_handler(checker_timeout, 0, INT_MAX)
declare_def_snprint(checker_timeout, print_nonzero)
declare_def_handler(flush_on_last_del, set_yes_no_undef)
@@ -630,13 +679,13 @@ declare_hw_snprint(deferred_remove, print_yes_no_undef)
declare_def_handler(allow_usb_devices, set_yes_no)
@@ -583,13 +632,13 @@ declare_hw_snprint(deferred_remove, print_yes_no_undef)
declare_mp_handler(deferred_remove, set_yes_no_undef)
declare_mp_snprint(deferred_remove, print_yes_no_undef)
@ -193,8 +193,8 @@ index a8872da7..686f4d5c 100644
declare_def_snprint(uev_wait_timeout, print_int)
declare_def_handler(strict_timing, set_yes_no)
@@ -662,19 +711,19 @@ static int snprint_def_disable_changed_wwids(struct config *conf, char *buff,
return print_ignored(buff, len);
@@ -616,19 +665,19 @@ static int snprint_def_disable_changed_wwids(struct config *conf,
return print_ignored(buff);
}
-declare_def_handler(remove_retries, set_int)
@ -219,7 +219,7 @@ index a8872da7..686f4d5c 100644
declare_def_snprint_defint(find_multipaths_timeout, print_int,
DEFAULT_FIND_MULTIPATHS_TIMEOUT)
@@ -1437,27 +1486,7 @@ declare_ovr_snprint(recheck_wwid, print_yes_no_undef)
@@ -1385,27 +1434,7 @@ declare_ovr_snprint(recheck_wwid, print_yes_no_undef)
declare_hw_handler(recheck_wwid, set_yes_no_undef)
declare_hw_snprint(recheck_wwid, print_yes_no_undef)

View File

@ -13,11 +13,11 @@ the existing config string, if any.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dict.c | 89 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 78 insertions(+), 11 deletions(-)
libmultipath/dict.c | 88 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 78 insertions(+), 10 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 686f4d5c..d547d898 100644
index 57b6a7b6..149d3348 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -5,6 +5,8 @@
@ -29,12 +29,9 @@ index 686f4d5c..d547d898 100644
#include <pwd.h>
#include <string.h>
#include "checkers.h"
@@ -121,7 +123,72 @@ set_regex(vector strvec, void *ptr, const char *file, int line_nr)
if (!*str_ptr)
return 1;
+ return 0;
+}
@@ -111,6 +113,72 @@ set_str(vector strvec, void *ptr, const char *file, int line_nr)
return 0;
}
+static int
+set_dir(vector strvec, void *ptr, const char *file, int line_nr)
@ -99,17 +96,13 @@ index 686f4d5c..d547d898 100644
+ *str_ptr = old_str;
+ } else
+ free(old_str);
return 0;
}
@@ -400,19 +467,19 @@ declare_def_snprint(checkint, print_int)
declare_def_handler(max_checkint, set_uint)
declare_def_snprint(max_checkint, print_int)
-declare_def_range_handler(verbosity, 0, MAX_VERBOSITY)
+declare_def_range_handler(verbosity, 0, 4)
declare_def_snprint(verbosity, print_int)
+ return 0;
+}
+
static int
set_yes_no(vector strvec, void *ptr, const char *file, int line_nr)
{
@@ -353,13 +421,13 @@ declare_def_snprint(verbosity, print_int)
declare_def_handler(reassign_maps, set_yes_no)
declare_def_snprint(reassign_maps, print_yes_no)
@ -125,7 +118,7 @@ index 686f4d5c..d547d898 100644
if (rc != 0)
return rc;
@@ -545,11 +612,11 @@ declare_hw_snprint(prio_name, print_str)
@@ -490,11 +558,11 @@ declare_hw_snprint(prio_name, print_str)
declare_mp_handler(prio_name, set_str)
declare_mp_snprint(prio_name, print_str)
@ -140,7 +133,7 @@ index 686f4d5c..d547d898 100644
declare_hw_snprint(alias_prefix, print_str)
declare_def_handler(prio_args, set_str)
@@ -633,13 +700,13 @@ declare_hw_snprint(user_friendly_names, print_yes_no_undef)
@@ -586,13 +654,13 @@ declare_hw_snprint(user_friendly_names, print_yes_no_undef)
declare_mp_handler(user_friendly_names, set_yes_no_undef)
declare_mp_snprint(user_friendly_names, print_yes_no_undef)
@ -157,7 +150,7 @@ index 686f4d5c..d547d898 100644
declare_def_snprint(prkeys_file, print_str)
declare_def_handler(retain_hwhandler, set_yes_no_undef)
@@ -738,7 +805,7 @@ def_config_dir_handler(struct config *conf, vector strvec, const char *file,
@@ -692,7 +760,7 @@ def_config_dir_handler(struct config *conf, vector strvec, const char *file,
/* this is only valid in the main config file */
if (conf->processed_main_config)
return 0;
@ -166,7 +159,7 @@ index 686f4d5c..d547d898 100644
}
declare_def_snprint(config_dir, print_str)
@@ -1781,7 +1848,7 @@ multipath_handler(struct config *conf, vector strvec, const char *file,
@@ -1732,7 +1800,7 @@ multipath_handler(struct config *conf, vector strvec, const char *file,
declare_mp_handler(wwid, set_str)
declare_mp_snprint(wwid, print_str)

View File

@ -0,0 +1,114 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 10 Nov 2021 18:34:08 -0600
Subject: [PATCH] libmultipath: deprecate file and directory config options
Having multipath able to select pathnames for the files and directories
it needs causes unnecessary maintainer headaches. Mark these as
deprecated, but still support them for now.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dict.c | 19 +++++++++++++++----
multipath/multipath.conf.5 | 5 +++++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 149d3348..d14be340 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -268,6 +268,15 @@ def_ ## option ## _handler (struct config *conf, vector strvec, \
return function (strvec, &conf->option, file, line_nr); \
}
+#define declare_def_warn_handler(option, function) \
+static int \
+def_ ## option ## _handler (struct config *conf, vector strvec, \
+ const char *file, int line_nr) \
+{ \
+ condlog(2, "%s line %d, \"" #option "\" is deprecated and will be disabled in a future release", file, line_nr); \
+ return function (strvec, &conf->option, file, line_nr); \
+}
+
#define declare_def_range_handler(option, minval, maxval) \
static int \
def_ ## option ## _handler (struct config *conf, vector strvec, \
@@ -421,7 +430,7 @@ declare_def_snprint(verbosity, print_int)
declare_def_handler(reassign_maps, set_yes_no)
declare_def_snprint(reassign_maps, print_yes_no)
-declare_def_handler(multipath_dir, set_dir)
+declare_def_warn_handler(multipath_dir, set_dir)
declare_def_snprint(multipath_dir, print_str)
static int def_partition_delim_handler(struct config *conf, vector strvec,
@@ -654,13 +663,13 @@ declare_hw_snprint(user_friendly_names, print_yes_no_undef)
declare_mp_handler(user_friendly_names, set_yes_no_undef)
declare_mp_snprint(user_friendly_names, print_yes_no_undef)
-declare_def_handler(bindings_file, set_path)
+declare_def_warn_handler(bindings_file, set_path)
declare_def_snprint(bindings_file, print_str)
-declare_def_handler(wwids_file, set_path)
+declare_def_warn_handler(wwids_file, set_path)
declare_def_snprint(wwids_file, print_str)
-declare_def_handler(prkeys_file, set_path)
+declare_def_warn_handler(prkeys_file, set_path)
declare_def_snprint(prkeys_file, print_str)
declare_def_handler(retain_hwhandler, set_yes_no_undef)
@@ -760,6 +769,8 @@ def_config_dir_handler(struct config *conf, vector strvec, const char *file,
/* this is only valid in the main config file */
if (conf->processed_main_config)
return 0;
+ condlog(2, "%s line %d, \"config_dir\" is deprecated and will be disabled in a future release",
+ file, line_nr);
return set_path(strvec, &conf->config_dir, file, line_nr);
}
declare_def_snprint(config_dir, print_str)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index dd9f4dc7..7f85f766 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -178,6 +178,7 @@ The default is: \fBno\fR
.
.TP
.B multipath_dir
+This option is deprecated, and will be removed in a future release.
Directory where the dynamic shared objects are stored. Defined at compile time,
commonly \fI/lib64/multipath/\fR or \fI/lib/multipath/\fR.
.RS
@@ -742,6 +743,7 @@ The default is: \fB<unset>\fR
.
.TP
.B bindings_file
+This option is deprecated, and will be removed in a future release.
The full pathname of the binding file to be used when the user_friendly_names
option is set.
.RS
@@ -752,6 +754,7 @@ The default is: \fB/etc/multipath/bindings\fR
.
.TP
.B wwids_file
+This option is deprecated, and will be removed in a future release.
The full pathname of the WWIDs file, which is used by multipath to keep track
of the WWIDs for LUNs it has created multipath devices on in the past.
.RS
@@ -762,6 +765,7 @@ The default is: \fB/etc/multipath/wwids\fR
.
.TP
.B prkeys_file
+This option is deprecated, and will be removed in a future release.
The full pathname of the prkeys file, which is used by multipathd to keep
track of the persistent reservation key used for a specific WWID, when
\fIreservation_key\fR is set to \fBfile\fR.
@@ -933,6 +937,7 @@ The default is: \fB<unset>\fR
.
.TP
.B config_dir
+This option is deprecated, and will be removed in a future release.
If set to anything other than "", multipath will search this directory
alphabetically for file ending in ".conf" and it will read configuration
information from them, just as if it was in \fI/etc/multipath.conf\fR.

View File

@ -14,11 +14,11 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 46 insertions(+), 36 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index d547d898..6330836a 100644
index d14be340..68647061 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -30,17 +30,12 @@
#include "dict.h"
@@ -31,17 +31,12 @@
#include "strbuf.h"
static int
-set_int(vector strvec, void *ptr, int min, int max, const char *file,
@ -38,7 +38,7 @@ index d547d898..6330836a 100644
res = strtol(buff, &eptr, 10);
if (eptr > buff)
@@ -49,17 +44,30 @@ set_int(vector strvec, void *ptr, int min, int max, const char *file,
@@ -50,17 +45,30 @@ set_int(vector strvec, void *ptr, int min, int max, const char *file,
if (*buff == '\0' || *eptr != '\0') {
condlog(1, "%s line %d, invalid value for %s: \"%s\"",
file, line_nr, (char*)VECTOR_SLOT(strvec, 0), buff);
@ -78,7 +78,7 @@ index d547d898..6330836a 100644
FREE(buff);
return rc;
@@ -965,6 +973,7 @@ declare_mp_attr_snprint(gid, print_gid)
@@ -929,6 +937,7 @@ declare_mp_attr_snprint(gid, print_gid)
static int
set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -86,7 +86,7 @@ index d547d898..6330836a 100644
char * buff;
int *int_ptr = (int *)ptr;
@@ -974,10 +983,10 @@ set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
@@ -938,10 +947,10 @@ set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
if (strcmp(buff, "off") == 0)
*int_ptr = UOZ_OFF;
@ -101,7 +101,7 @@ index d547d898..6330836a 100644
*int_ptr = UOZ_ZERO;
FREE(buff);
@@ -1130,14 +1139,12 @@ max_fds_handler(struct config *conf, vector strvec, const char *file,
@@ -1093,14 +1102,12 @@ max_fds_handler(struct config *conf, vector strvec, const char *file,
/* Assume safe limit */
max_fds = 4096;
}
@ -121,7 +121,7 @@ index d547d898..6330836a 100644
FREE(buff);
@@ -1206,6 +1213,7 @@ declare_mp_snprint(rr_weight, print_rr_weight)
@@ -1169,6 +1176,7 @@ declare_mp_snprint(rr_weight, print_rr_weight)
static int
set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -129,7 +129,7 @@ index d547d898..6330836a 100644
int *int_ptr = (int *)ptr;
char * buff;
@@ -1220,11 +1228,11 @@ set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1183,11 +1191,11 @@ set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
else if (strlen(buff) == 10 && !strcmp(buff, "followover"))
*int_ptr = -FAILBACK_FOLLOWOVER;
else
@ -143,7 +143,7 @@ index d547d898..6330836a 100644
}
int
@@ -1256,6 +1264,7 @@ declare_mp_snprint(pgfailback, print_pgfailback)
@@ -1219,6 +1227,7 @@ declare_mp_snprint(pgfailback, print_pgfailback)
static int
no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -151,7 +151,7 @@ index d547d898..6330836a 100644
int *int_ptr = (int *)ptr;
char * buff;
@@ -1267,11 +1276,11 @@ no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1230,11 +1239,11 @@ no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
*int_ptr = NO_PATH_RETRY_FAIL;
else if (!strcmp(buff, "queue"))
*int_ptr = NO_PATH_RETRY_QUEUE;
@ -166,7 +166,7 @@ index d547d898..6330836a 100644
}
int
@@ -1416,6 +1425,7 @@ snprint_mp_reservation_key (struct config *conf, char * buff, int len,
@@ -1376,6 +1385,7 @@ snprint_mp_reservation_key (struct config *conf, struct strbuf *buff,
static int
set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -174,7 +174,7 @@ index d547d898..6330836a 100644
int *int_ptr = (int *)ptr;
char * buff;
@@ -1425,11 +1435,11 @@ set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1385,11 +1395,11 @@ set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
if (!strcmp(buff, "no") || !strcmp(buff, "0"))
*int_ptr = NU_NO;

View File

@ -14,10 +14,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 51 insertions(+), 22 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 6330836a..b255322e 100644
index 68647061..c534d703 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -212,8 +212,11 @@ set_yes_no(vector strvec, void *ptr, const char *file, int line_nr)
@@ -199,8 +199,11 @@ set_yes_no(vector strvec, void *ptr, const char *file, int line_nr)
if (strcmp(buff, "yes") == 0 || strcmp(buff, "1") == 0)
*int_ptr = YN_YES;
@ -30,7 +30,7 @@ index 6330836a..b255322e 100644
FREE(buff);
return 0;
@@ -234,7 +237,8 @@ set_yes_no_undef(vector strvec, void *ptr, const char *file, int line_nr)
@@ -221,7 +224,8 @@ set_yes_no_undef(vector strvec, void *ptr, const char *file, int line_nr)
else if (strcmp(buff, "yes") == 0 || strcmp(buff, "1") == 0)
*int_ptr = YNU_YES;
else
@ -40,7 +40,7 @@ index 6330836a..b255322e 100644
FREE(buff);
return 0;
@@ -523,9 +527,6 @@ def_find_multipaths_handler(struct config *conf, vector strvec,
@@ -480,9 +484,6 @@ def_find_multipaths_handler(struct config *conf, vector strvec,
char *buff;
int i;
@ -50,7 +50,7 @@ index 6330836a..b255322e 100644
buff = set_value(strvec);
if (!buff)
return 1;
@@ -538,9 +539,14 @@ def_find_multipaths_handler(struct config *conf, vector strvec,
@@ -495,9 +496,14 @@ def_find_multipaths_handler(struct config *conf, vector strvec,
}
}
@ -68,7 +68,7 @@ index 6330836a..b255322e 100644
}
FREE(buff);
@@ -591,8 +597,10 @@ static int uid_attrs_handler(struct config *conf, vector strvec,
@@ -546,8 +552,10 @@ static int uid_attrs_handler(struct config *conf, vector strvec,
if (!val)
return 1;
if (parse_uid_attrs(val, conf))
@ -81,7 +81,7 @@ index 6330836a..b255322e 100644
FREE(val);
return 0;
}
@@ -811,8 +819,11 @@ def_config_dir_handler(struct config *conf, vector strvec, const char *file,
@@ -775,8 +783,11 @@ def_config_dir_handler(struct config *conf, vector strvec, const char *file,
int line_nr)
{
/* this is only valid in the main config file */
@ -91,10 +91,10 @@ index 6330836a..b255322e 100644
+ file, line_nr);
return 0;
+ }
condlog(2, "%s line %d, \"config_dir\" is deprecated and will be disabled in a future release",
file, line_nr);
return set_path(strvec, &conf->config_dir, file, line_nr);
}
declare_def_snprint(config_dir, print_str)
@@ -872,7 +883,9 @@ set_mode(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
@@ -836,7 +847,9 @@ set_mode(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
if (sscanf(buff, "%o", &mode) == 1 && mode <= 0777) {
*flags |= (1 << ATTR_MODE);
*mode_ptr = mode;
@ -105,7 +105,7 @@ index 6330836a..b255322e 100644
FREE(buff);
return 0;
@@ -897,7 +910,9 @@ set_uid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
@@ -861,7 +874,9 @@ set_uid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
else if (sscanf(buff, "%u", &uid) == 1){
*flags |= (1 << ATTR_UID);
*uid_ptr = uid;
@ -116,7 +116,7 @@ index 6330836a..b255322e 100644
FREE(buff);
return 0;
@@ -923,7 +938,9 @@ set_gid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
@@ -887,7 +902,9 @@ set_gid(vector strvec, void *ptr, int *flags, const char *file, int line_nr)
else if (sscanf(buff, "%u", &gid) == 1){
*flags |= (1 << ATTR_GID);
*gid_ptr = gid;
@ -127,17 +127,17 @@ index 6330836a..b255322e 100644
FREE(buff);
return 0;
}
@@ -1026,7 +1043,8 @@ set_dev_loss(vector strvec, void *ptr, const char *file, int line_nr)
@@ -989,7 +1006,8 @@ set_dev_loss(vector strvec, void *ptr, const char *file, int line_nr)
if (!strcmp(buff, "infinity"))
*uint_ptr = MAX_DEV_LOSS_TMO;
else if (sscanf(buff, "%u", uint_ptr) != 1)
- *uint_ptr = 0;
- *uint_ptr = DEV_LOSS_TMO_UNSET;
+ condlog(1, "%s line %d, invalid value for dev_loss_tmo: \"%s\"",
+ file, line_nr, buff);
FREE(buff);
return 0;
@@ -1060,13 +1078,19 @@ static int
@@ -1023,13 +1041,19 @@ static int
set_pgpolicy(vector strvec, void *ptr, const char *file, int line_nr)
{
char * buff;
@ -158,7 +158,7 @@ index 6330836a..b255322e 100644
FREE(buff);
return 0;
@@ -1179,10 +1203,11 @@ set_rr_weight(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1142,10 +1166,11 @@ set_rr_weight(vector strvec, void *ptr, const char *file, int line_nr)
if (!strcmp(buff, "priorities"))
*int_ptr = RR_WEIGHT_PRIO;
@ -173,7 +173,7 @@ index 6330836a..b255322e 100644
FREE(buff);
return 0;
@@ -1318,10 +1343,13 @@ def_log_checker_err_handler(struct config *conf, vector strvec,
@@ -1281,10 +1306,13 @@ def_log_checker_err_handler(struct config *conf, vector strvec,
if (!buff)
return 1;
@ -189,7 +189,7 @@ index 6330836a..b255322e 100644
free(buff);
return 0;
@@ -1585,7 +1613,8 @@ hw_vpd_vendor_handler(struct config *conf, vector strvec, const char *file,
@@ -1545,7 +1573,8 @@ hw_vpd_vendor_handler(struct config *conf, vector strvec, const char *file,
goto out;
}
}

View File

@ -14,19 +14,19 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 25 insertions(+), 39 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index b255322e..5a0255b0 100644
index c534d703..1b75be47 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -29,7 +29,7 @@
#include "mpath_cmd.h"
@@ -30,7 +30,7 @@
#include "dict.h"
#include "strbuf.h"
-static int
+static void
do_set_int(vector strvec, void *ptr, int min, int max, const char *file,
int line_nr, char *buff)
{
@@ -44,7 +44,7 @@ do_set_int(vector strvec, void *ptr, int min, int max, const char *file,
@@ -45,7 +45,7 @@ do_set_int(vector strvec, void *ptr, int min, int max, const char *file,
if (*buff == '\0' || *eptr != '\0') {
condlog(1, "%s line %d, invalid value for %s: \"%s\"",
file, line_nr, (char*)VECTOR_SLOT(strvec, 0), buff);
@ -35,7 +35,7 @@ index b255322e..5a0255b0 100644
}
if (res > max || res < min) {
res = (res > max) ? max : min;
@@ -53,7 +53,7 @@ do_set_int(vector strvec, void *ptr, int min, int max, const char *file,
@@ -54,7 +54,7 @@ do_set_int(vector strvec, void *ptr, int min, int max, const char *file,
(res == max)? "large" : "small", res);
}
*int_ptr = res;
@ -44,7 +44,7 @@ index b255322e..5a0255b0 100644
}
static int
@@ -61,16 +61,15 @@ set_int(vector strvec, void *ptr, int min, int max, const char *file,
@@ -62,16 +62,15 @@ set_int(vector strvec, void *ptr, int min, int max, const char *file,
int line_nr)
{
char *buff;
@ -63,7 +63,7 @@ index b255322e..5a0255b0 100644
}
static int
@@ -79,7 +78,6 @@ set_uint(vector strvec, void *ptr, const char *file, int line_nr)
@@ -80,7 +79,6 @@ set_uint(vector strvec, void *ptr, const char *file, int line_nr)
unsigned int *uint_ptr = (unsigned int *)ptr;
char *buff, *eptr, *p;
unsigned long res;
@ -71,7 +71,7 @@ index b255322e..5a0255b0 100644
buff = set_value(strvec);
if (!buff)
@@ -92,17 +90,14 @@ set_uint(vector strvec, void *ptr, const char *file, int line_nr)
@@ -93,17 +91,14 @@ set_uint(vector strvec, void *ptr, const char *file, int line_nr)
if (eptr > buff)
while (isspace(*eptr))
eptr++;
@ -92,7 +92,7 @@ index b255322e..5a0255b0 100644
}
static int
@@ -990,7 +985,6 @@ declare_mp_attr_snprint(gid, print_gid)
@@ -954,7 +949,6 @@ declare_mp_attr_snprint(gid, print_gid)
static int
set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -100,7 +100,7 @@ index b255322e..5a0255b0 100644
char * buff;
int *int_ptr = (int *)ptr;
@@ -1000,11 +994,10 @@ set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
@@ -964,11 +958,10 @@ set_undef_off_zero(vector strvec, void *ptr, const char *file, int line_nr)
if (strcmp(buff, "off") == 0)
*int_ptr = UOZ_OFF;
@ -115,7 +115,7 @@ index b255322e..5a0255b0 100644
FREE(buff);
return 0;
@@ -1151,28 +1144,24 @@ max_fds_handler(struct config *conf, vector strvec, const char *file,
@@ -1114,28 +1107,24 @@ max_fds_handler(struct config *conf, vector strvec, const char *file,
int line_nr)
{
char * buff;
@ -152,7 +152,7 @@ index b255322e..5a0255b0 100644
}
static int
@@ -1238,7 +1227,6 @@ declare_mp_snprint(rr_weight, print_rr_weight)
@@ -1201,7 +1190,6 @@ declare_mp_snprint(rr_weight, print_rr_weight)
static int
set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -160,7 +160,7 @@ index b255322e..5a0255b0 100644
int *int_ptr = (int *)ptr;
char * buff;
@@ -1253,11 +1241,11 @@ set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1216,11 +1204,11 @@ set_pgfailback(vector strvec, void *ptr, const char *file, int line_nr)
else if (strlen(buff) == 10 && !strcmp(buff, "followover"))
*int_ptr = -FAILBACK_FOLLOWOVER;
else
@ -174,7 +174,7 @@ index b255322e..5a0255b0 100644
}
int
@@ -1289,7 +1277,6 @@ declare_mp_snprint(pgfailback, print_pgfailback)
@@ -1252,7 +1240,6 @@ declare_mp_snprint(pgfailback, print_pgfailback)
static int
no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -182,7 +182,7 @@ index b255322e..5a0255b0 100644
int *int_ptr = (int *)ptr;
char * buff;
@@ -1302,10 +1289,10 @@ no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1265,10 +1252,10 @@ no_path_retry_helper(vector strvec, void *ptr, const char *file, int line_nr)
else if (!strcmp(buff, "queue"))
*int_ptr = NO_PATH_RETRY_QUEUE;
else
@ -195,7 +195,7 @@ index b255322e..5a0255b0 100644
}
int
@@ -1453,7 +1440,6 @@ snprint_mp_reservation_key (struct config *conf, char * buff, int len,
@@ -1413,7 +1400,6 @@ snprint_mp_reservation_key (struct config *conf, struct strbuf *buff,
static int
set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
{
@ -203,7 +203,7 @@ index b255322e..5a0255b0 100644
int *int_ptr = (int *)ptr;
char * buff;
@@ -1464,10 +1450,10 @@ set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1424,10 +1410,10 @@ set_off_int_undef(vector strvec, void *ptr, const char *file, int line_nr)
if (!strcmp(buff, "no") || !strcmp(buff, "0"))
*int_ptr = NU_NO;
else

View File

@ -14,13 +14,27 @@ device from read-only to read/write.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/sysfs.c | 22 ++++++++++++++++++++++
libmultipath/sysfs.h | 1 +
multipathd/main.c | 31 ++++++++++++++++++++++++++++++-
3 files changed, 53 insertions(+), 1 deletion(-)
libmultipath/libmultipath.version | 5 +++++
libmultipath/sysfs.c | 22 ++++++++++++++++++++++
libmultipath/sysfs.h | 1 +
multipathd/main.c | 31 ++++++++++++++++++++++++++++++-
4 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index eb5b5b55..dd1b4122 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -287,3 +287,8 @@ global:
local:
*;
};
+
+LIBMULTIPATH_9.1.0 {
+global:
+ sysfs_get_ro;
+} LIBMULTIPATH_9.0.0;
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 62ec2ed7..a57bd60e 100644
index 9ff145f2..24c12b6a 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -236,6 +236,28 @@ sysfs_get_size (struct path *pp, unsigned long long * size)
@ -53,7 +67,7 @@ index 62ec2ed7..a57bd60e 100644
{
unsigned int major, new_minor, table_minor;
diff --git a/libmultipath/sysfs.h b/libmultipath/sysfs.h
index 9ae30b39..91092e44 100644
index 72b39ab2..c948c467 100644
--- a/libmultipath/sysfs.h
+++ b/libmultipath/sysfs.h
@@ -13,6 +13,7 @@ ssize_t sysfs_attr_get_value(struct udev_device *dev, const char *attr_name,
@ -62,14 +76,14 @@ index 9ae30b39..91092e44 100644
int sysfs_get_size (struct path *pp, unsigned long long * size);
+int sysfs_get_ro(struct path *pp);
int sysfs_check_holders(char * check_devt, char * new_devt);
bool sysfs_is_multipathed(const struct path *pp);
bool sysfs_is_multipathed(struct path *pp, bool set_wwid);
#endif
diff --git a/multipathd/main.c b/multipathd/main.c
index 823b53a2..e2b9d546 100644
index 1defeaf1..6145e512 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1256,6 +1256,35 @@ fail:
return PATH_REMOVE_FAILED;
@@ -1324,6 +1324,35 @@ fail:
return REMOVE_PATH_MAP_ERROR;
}
+static bool
@ -104,7 +118,7 @@ index 823b53a2..e2b9d546 100644
static int
uev_update_path (struct uevent *uev, struct vectors * vecs)
{
@@ -1321,7 +1350,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
@@ -1388,7 +1417,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
}
ro = uevent_get_disk_ro(uev);

View File

@ -0,0 +1,26 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Fri, 22 Oct 2021 12:58:11 +0200
Subject: [PATCH] multipath: fix exit status of multipath -T
We must set the return value in configure().
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/multipath/main.c b/multipath/main.c
index 748e7902..80fa68e5 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -606,6 +606,7 @@ configure (struct config *conf, enum mpath_cmds cmd,
dump_config(conf, hwes, curmp);
vector_free(hwes);
+ r = RTVL_OK;
goto out;
}

View File

@ -0,0 +1,34 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 13 Dec 2021 14:26:30 -0600
Subject: [PATCH] RH: mpathconf: fix setting property_blacklist
If there was no blacklist_exceptions section, setting property_blacklist
didn't work correctly. Fix it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/mpathconf | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/multipath/mpathconf b/multipath/mpathconf
index c00d2555..0de6b121 100644
--- a/multipath/mpathconf
+++ b/multipath/mpathconf
@@ -496,7 +496,15 @@ if [ "$PROPERTY" = "n" ]; then
CHANGED_CONFIG=1
fi
elif [ "$PROPERTY" = "y" ]; then
- if [ -z "$HAVE_PROPERTY" ]; then
+ if [ -z "$HAVE_PROPERTY" -a -z "$HAVE_EXCEPTIONS" ]; then
+ cat >> $TMPFILE << _EOF_
+
+blacklist_exceptions {
+ property "(SCSI_IDENT_|ID_WWN)"
+}
+_EOF_
+ CHANGED_CONFIG=1
+ elif [ -z "$HAVE_PROPERTY" ]; then
sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
property "(SCSI_IDENT_|ID_WWN)"
' $TMPFILE

View File

@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 12 Jan 2022 12:26:12 -0600
Subject: [PATCH] libmultipath: fix disassemble status for
historical-service-time PS
The historical-service-time path selector prints out 2 path group status
arguments. This is the only path selector that uses the group status
arguments. All the others only have path status arguments.
disassemble_status() was expecting the number of group status arguments
to always be zero, causing it to fail at disassembling the status of
devices that use historical-service-time path selector. Now multipath
actually checks the number of group arguments, and skips them.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dmparser.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 4ba7f339..bc311421 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -437,9 +437,19 @@ int disassemble_status(const char *params, struct multipath *mpp)
FREE(word);
/*
- * PG Status (discarded, would be '0' anyway)
+ * Path Selector Group Arguments
*/
- p += get_word(p, NULL);
+ p += get_word(p, &word);
+
+ if (!word)
+ return 1;
+
+ num_pg_args = atoi(word);
+ free(word);
+
+ /* Ignore ps group arguments */
+ for (j = 0; j < num_pg_args; j++)
+ p += get_word(p, NULL);
p += get_word(p, &word);

View File

@ -15,10 +15,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 files changed, 43 insertions(+), 37 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 9c8d3e34..9a9890f5 100644
index 7edb355b..043e4232 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -545,11 +545,8 @@ unref:
@@ -565,11 +565,8 @@ unref:
}
void
@ -31,7 +31,7 @@ index 9c8d3e34..9a9890f5 100644
/*
* If a path changes from multipath to non-multipath, we must
* synthesize an artificial "add" event, otherwise the LVM2 rules
@@ -557,6 +554,45 @@ trigger_paths_udev_change(struct multipath *mpp, bool is_mpath)
@@ -577,6 +574,45 @@ trigger_paths_udev_change(struct multipath *mpp, bool is_mpath)
* irritate ourselves with an "add", so use "change".
*/
const char *action = is_mpath ? "change" : "add";
@ -77,7 +77,7 @@ index 9c8d3e34..9a9890f5 100644
if (!mpp || !mpp->pg)
return;
@@ -564,39 +600,8 @@ trigger_paths_udev_change(struct multipath *mpp, bool is_mpath)
@@ -584,39 +620,8 @@ trigger_paths_udev_change(struct multipath *mpp, bool is_mpath)
vector_foreach_slot (mpp->pg, pgp, i) {
if (!pgp->paths)
continue;
@ -120,12 +120,12 @@ index 9c8d3e34..9a9890f5 100644
mpp->needs_paths_uevent = 0;
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 8a266d31..5cf08d45 100644
index efe18b7d..2bf73e65 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -56,6 +56,7 @@ int get_refwwid (enum mpath_cmds cmd, char * dev, enum devtypes dev_type,
@@ -56,6 +56,7 @@ int coalesce_paths (struct vectors *vecs, vector curmp, char * refwwid, int forc
int get_refwwid (enum mpath_cmds cmd, const char *dev, enum devtypes dev_type,
vector pathvec, char **wwid);
int reload_map(struct vectors *vecs, struct multipath *mpp, int refresh, int is_daemon);
struct udev_device *get_udev_device(const char *dev, enum devtypes dev_type);
+void trigger_path_udev_change(struct path *pp, bool is_mpath);
void trigger_paths_udev_change(struct multipath *mpp, bool is_mpath);

View File

@ -22,14 +22,28 @@ claimed by multipath, and if not, triggers a uevent to claim it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 2 ++
1 file changed, 2 insertions(+)
libmultipath/libmultipath.version | 5 +++++
multipathd/main.c | 2 ++
2 files changed, 7 insertions(+)
diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index dd1b4122..0d89e9e1 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -292,3 +292,8 @@ LIBMULTIPATH_9.1.0 {
global:
sysfs_get_ro;
} LIBMULTIPATH_9.0.0;
+
+LIBMULTIPATH_9.1.1 {
+global:
+ trigger_path_udev_change;
+} LIBMULTIPATH_9.1.0;
diff --git a/multipathd/main.c b/multipathd/main.c
index e2b9d546..f4b79882 100644
index 6145e512..5def5301 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1005,6 +1005,8 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
@@ -1062,6 +1062,8 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
free_path(pp);
return 1;
}

View File

@ -14,7 +14,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 files changed, 62 insertions(+), 3 deletions(-)
diff --git a/multipath/mpathconf b/multipath/mpathconf
index 5f2285ab..870512c0 100644
index 0de6b121..6e33fb99 100644
--- a/multipath/mpathconf
+++ b/multipath/mpathconf
@@ -17,7 +17,7 @@
@ -26,15 +26,15 @@ index 5f2285ab..870512c0 100644
DEFAULT_CONFIG="# device-mapper-multipath configuration file
@@ -57,6 +57,7 @@ function usage
@@ -52,6 +52,7 @@ function usage
echo "Set find_multipaths (Default y): --find_multipaths <yes|no|strict|greedy|smart>"
echo "Set default property blacklist (Default y): --property_blacklist <y|n>"
echo "Set default property blacklist (Default n): --property_blacklist <y|n>"
echo "Set enable_foreign to show foreign devices (Default n): --enable_foreign <y|n>"
+ echo "Add/Change/Remove option in defaults section: --option <option_name>:<value>"
echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
echo "select output file (Default /etc/multipath.conf): --outfile <FILE>"
@@ -167,6 +168,20 @@ function parse_args
@@ -162,6 +163,20 @@ function parse_args
exit 1
fi
;;
@ -55,7 +55,7 @@ index 5f2285ab..870512c0 100644
--enable_foreign)
if [ -n "$2" ]; then
FOREIGN=$2
@@ -213,12 +228,15 @@ function parse_args
@@ -208,12 +223,15 @@ function parse_args
function validate_args
{
@ -72,7 +72,7 @@ index 5f2285ab..870512c0 100644
fi
if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
echo "--user_friendly_names must be either 'y' or 'n'"
@@ -240,7 +258,19 @@ function validate_args
@@ -235,7 +253,19 @@ function validate_args
echo "--enable_foreign must be either 'y' or 'n'"
exit 1
fi
@ -93,9 +93,9 @@ index 5f2285ab..870512c0 100644
SHOW_STATUS=1
fi
if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
@@ -349,6 +379,13 @@ if [ "$HAVE_DEFAULTS" = "1" ]; then
@@ -348,6 +378,13 @@ if [ "$HAVE_DEFAULTS" = "1" ]; then
elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign" ; then
HAVE_FOREIGN=2
HAVE_FOREIGN=3
fi
+ if [ -n "$OPTION_NAME" ]; then
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q '^[[:space:]]*'"$OPTION_NAME"'[[:space:]][[:space:]]*'"$OPTION_VALUE" ; then
@ -107,7 +107,7 @@ index 5f2285ab..870512c0 100644
fi
if [ "$HAVE_EXCEPTIONS" = "1" ]; then
@@ -523,6 +560,21 @@ elif [ "$FOREIGN" = "n" ]; then
@@ -532,6 +569,21 @@ elif [ "$FOREIGN" = "y" ]; then
fi
fi
@ -130,11 +130,11 @@ index 5f2285ab..870512c0 100644
cp $OUTPUTFILE $OUTPUTFILE.old
if [ $? != 0 ]; then
diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
index 83515eb4..63fe633e 100644
index a14d831e..496383b7 100644
--- a/multipath/mpathconf.8
+++ b/multipath/mpathconf.8
@@ -101,6 +101,13 @@ to the
defaults section. if set to \fBy\fP, this removes the line, if present. This
defaults section. if set to \fBn\fP, this removes the line, if present. This
command can be used along with any other command.
.TP
+.B --option \fB<option_name>:[<value>]\fP

View File

@ -0,0 +1,154 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 3 Feb 2022 13:26:18 -0600
Subject: [PATCH] RH: add support to mpathconf for setting recheck_wwid
mpathconf now supports --recheck_wwid <y|n> for setthing the
recheck_wwid option
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/mpathconf | 48 ++++++++++++++++++++++++++++++++++++++++---
multipath/mpathconf.8 | 9 ++++++++
2 files changed, 54 insertions(+), 3 deletions(-)
diff --git a/multipath/mpathconf b/multipath/mpathconf
index 6e33fb99..319664b1 100644
--- a/multipath/mpathconf
+++ b/multipath/mpathconf
@@ -17,7 +17,7 @@
# This program was largely ripped off from lvmconf
#
-unset ENABLE FIND FRIENDLY PROPERTY FOREIGN MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_PROPERTY HAVE_FOREIGN HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST HAVE_OPTION OPTION_NAME OPTION_VALUE
+unset ENABLE FIND FRIENDLY PROPERTY FOREIGN MODULE MULTIPATHD HAVE_DISABLE HAVE_WWID_DISABLE HAVE_FIND HAVE_BLACKLIST HAVE_EXCEPTIONS HAVE_DEFAULTS HAVE_FRIENDLY HAVE_PROPERTY HAVE_FOREIGN HAVE_MULTIPATHD HAVE_MODULE HAVE_OUTFILE SHOW_STATUS CHANGED_CONFIG WWID_LIST HAVE_OPTION OPTION_NAME OPTION_VALUE HAVE_RECHECK_WWID RECHECK_WWID
DEFAULT_CONFIG="# device-mapper-multipath configuration file
@@ -52,6 +52,7 @@ function usage
echo "Set find_multipaths (Default y): --find_multipaths <yes|no|strict|greedy|smart>"
echo "Set default property blacklist (Default n): --property_blacklist <y|n>"
echo "Set enable_foreign to show foreign devices (Default n): --enable_foreign <y|n>"
+ echo "Set recheck_wwid (Defaut n): --recheck_wwid <y|n>"
echo "Add/Change/Remove option in defaults section: --option <option_name>:<value>"
echo "Load the dm-multipath modules on enable (Default y): --with_module <y|n>"
echo "start/stop/reload multipathd (Default n): --with_multipathd <y|n>"
@@ -145,6 +146,15 @@ function parse_args
exit 1
fi
;;
+ --recheck_wwid)
+ if [ -n "$2" ]; then
+ RECHECK_WWID=$2
+ shift 2
+ else
+ usage
+ exit 1
+ fi
+ ;;
--find_multipaths)
if [ -n "$2" ]; then
FIND=$2
@@ -223,7 +233,7 @@ function parse_args
function validate_args
{
- if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$PROPERTY" -o -n "$MODULE" -o -n "$FOREIGN" -o -n "$OPTION_NAME" ]; then
+ if [ "$ENABLE" = "0" ] && [ -n "$FRIENDLY" -o -n "$FIND" -o -n "$PROPERTY" -o -n "$MODULE" -o -n "$FOREIGN" -o -n "$OPTION_NAME" -o -n "$RECHECK_WWID" ]; then
echo "ignoring extra parameters on disable"
FRIENDLY=""
FIND=""
@@ -232,11 +242,16 @@ function validate_args
FOREIGN=""
OPTION_NAME=""
OPTION_VALUE=""
+ RECHECK_WWID=""
fi
if [ -n "$FRIENDLY" ] && [ "$FRIENDLY" != "y" -a "$FRIENDLY" != "n" ]; then
echo "--user_friendly_names must be either 'y' or 'n'"
exit 1
fi
+ if [ -n "$RECHECK_WWID" ] && [ "$RECHECK_WWID" != "y" -a "$RECHECK_WWID" != "n" ]; then
+ echo "--recheck_wwid must be either 'y' or 'n'"
+ exit 1
+ fi
if [ "$FIND" = "y" ]; then
FIND="yes"
elif [ "$FIND" = "n" ]; then
@@ -265,7 +280,7 @@ function validate_args
OPTION_VALUE=\"$OPTION_VALUE\"
fi
fi
- if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" -a -z "$FOREIGN" -a -z "$OPTION_NAME" ]; then
+ if [ -z "$ENABLE" -a -z "$FIND" -a -z "$FRIENDLY" -a -z "$PROPERTY" -a -z "$FOREIGN" -a -z "$OPTION_NAME" -a -z "$RECHECK_WWID" ]; then
SHOW_STATUS=1
fi
if [ -n "$MODULE" ] && [ "$MODULE" != "y" -a "$MODULE" != "n" ]; then
@@ -367,6 +382,11 @@ if [ "$HAVE_DEFAULTS" = "1" ]; then
elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*user_friendly_names[[:space:]][[:space:]]*\(no\|0\)" ; then
HAVE_FRIENDLY=0
fi
+ if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(yes\|1\)" ; then
+ HAVE_RECHECK_WWID=1
+ elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(no\|0\)" ; then
+ HAVE_RECHECK_WWID=0
+ fi
if sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*#[[:space:]]*enable_foreign" ; then
HAVE_FOREIGN=0
elif sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | grep -q "^[[:space:]]*enable_foreign[[:space:]][[:space:]]*\"\.\*\"" ; then
@@ -411,6 +431,11 @@ if [ -n "$SHOW_STATUS" ]; then
else
echo "user_friendly_names is enabled"
fi
+ if [ -z "$HAVE_RECHECK_WWID" -o "$HAVE_RECHECK_WWID" = 0 ]; then
+ echo "recheck_wwid is disabled"
+ else
+ echo "recheck_wwid is enabled"
+ fi
if [ -z "$HAVE_PROPERTY" -o "$HAVE_PROPERTY" = 0 ]; then
echo "default property blacklist is disabled"
else
@@ -527,6 +552,23 @@ elif [ "$FRIENDLY" = "y" ]; then
fi
fi
+if [ "$RECHECK_WWID" = "n" ]; then
+ if [ "$HAVE_RECHECK_WWID" = 1 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(yes\|1\)/ recheck_wwid no/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+elif [ "$RECHECK_WWID" = "y" ]; then
+ if [ -z "$HAVE_RECHECK_WWID" ]; then
+ sed -i '/^defaults[[:space:]]*{/ a\
+ recheck_wwid yes
+' $TMPFILE
+ CHANGED_CONFIG=1
+ elif [ "$HAVE_RECHECK_WWID" = 0 ]; then
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:space:]]*recheck_wwid[[:space:]][[:space:]]*\(no\|0\)/ recheck_wwid yes/' $TMPFILE
+ CHANGED_CONFIG=1
+ fi
+fi
+
if [ "$PROPERTY" = "n" ]; then
if [ "$HAVE_PROPERTY" = 1 ]; then
sed -i '/^blacklist_exceptions[[:space:]]*{/,/^}/ s/^[[:space:]]*property[[:space:]][[:space:]]*\"(SCSI_IDENT_|ID_WWN)\"/# property \"(SCSI_IDENT_|ID_WWN)\"/' $TMPFILE
diff --git a/multipath/mpathconf.8 b/multipath/mpathconf.8
index 496383b7..9c2fb835 100644
--- a/multipath/mpathconf.8
+++ b/multipath/mpathconf.8
@@ -77,6 +77,15 @@ to the
defaults section. If set to \fBn\fP, this removes the line, if present. This
command can be used along with any other command.
.TP
+.B --recheck_wwid \fP { \fBy\fP | \fBn\fP }
+If set to \fBy\fP, this adds the line
+.B recheck_wwid yes
+to the
+.B /etc/multipath.conf
+defaults section, or sets an existing line to \fByes\fP. If set to \fBn\fP, this
+sets an existing \fBrecheck_wwid\fP line to \fBno\fP. This command can be used
+along with any other command.
+.TP
.B --find_multipaths\fP { \fByes\fP | \fBno\fP | \fBstrict\fP | \fBgreedy\fP | \fBsmart\fP }
If set to \fB<value>\fP, this adds the line
.B find_multipaths <value>

View File

@ -29,25 +29,26 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
Makefile.inc | 13 +
libmultipath/Makefile | 5 +
libmultipath/dict.c | 56 +++-
libmultipath/propsel.c | 47 +++-
libmultipath/structs.h | 7 +
multipath/multipath.conf.5 | 19 +-
multipathd/Makefile | 10 +
multipathd/fpin.h | 20 ++
multipathd/fpin_handlers.c | 541 +++++++++++++++++++++++++++++++++++++
multipathd/main.c | 35 ++-
10 files changed, 738 insertions(+), 15 deletions(-)
Makefile.inc | 13 +
libmultipath/Makefile | 5 +
libmultipath/dict.c | 56 +++-
libmultipath/libmultipath.version | 5 +
libmultipath/propsel.c | 47 ++-
libmultipath/structs.h | 7 +
multipath/multipath.conf.5 | 19 +-
multipathd/Makefile | 10 +
multipathd/fpin.h | 20 ++
multipathd/fpin_handlers.c | 540 ++++++++++++++++++++++++++++++
multipathd/main.c | 43 ++-
11 files changed, 749 insertions(+), 16 deletions(-)
create mode 100644 multipathd/fpin.h
create mode 100644 multipathd/fpin_handlers.c
diff --git a/Makefile.inc b/Makefile.inc
index 220009e0..25c16f4e 100644
index 5ac660de..688c4599 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -146,6 +146,19 @@ check_file = $(shell \
@@ -149,6 +149,19 @@ check_file = $(shell \
echo "$$found" \
)
@ -68,10 +69,10 @@ index 220009e0..25c16f4e 100644
@echo building $@ because of $?
$(CC) $(CFLAGS) -c -o $@ $<
diff --git a/libmultipath/Makefile b/libmultipath/Makefile
index ad690a49..49f71dfa 100644
index 7f3921c5..8a960419 100644
--- a/libmultipath/Makefile
+++ b/libmultipath/Makefile
@@ -40,6 +40,11 @@ ifneq ($(call check_func,dm_hold_control_dev,/usr/include/libdevmapper.h),0)
@@ -45,6 +45,11 @@ ifneq ($(call check_func,dm_hold_control_dev,/usr/include/libdevmapper.h),0)
CFLAGS += -DLIBDM_API_HOLD_CONTROL
endif
@ -84,10 +85,10 @@ index ad690a49..49f71dfa 100644
hwtable.o blacklist.o util.o dmparser.o config.o \
structs.o discovery.o propsel.o dict.o \
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 8321ec1e..d7cd94a5 100644
index 1b75be47..eb5a8083 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -579,6 +579,59 @@ snprint_def_find_multipaths(struct config *conf, char *buff, int len,
@@ -513,6 +513,59 @@ snprint_def_find_multipaths(struct config *conf, struct strbuf *buff,
find_multipaths_optvals[conf->find_multipaths]);
}
@ -136,18 +137,18 @@ index 8321ec1e..d7cd94a5 100644
+}
+
+static int
+snprint_def_marginal_pathgroups(struct config *conf, char *buff, int len,
+snprint_def_marginal_pathgroups(struct config *conf, struct strbuf *buff,
+ const void *data)
+{
+ return snprintf(buff, len, "\"%s\"",
+ marginal_pathgroups_optvals[conf->marginal_pathgroups]);
+ return append_strbuf_quoted(buff,
+ marginal_pathgroups_optvals[conf->marginal_pathgroups]);
+}
+
+
declare_def_handler(selector, set_str)
declare_def_snprint_defstr(selector, print_str, DEFAULT_SELECTOR)
declare_hw_handler(selector, set_str)
@@ -1596,9 +1649,6 @@ declare_ovr_snprint(all_tg_pt, print_yes_no_undef)
@@ -1527,9 +1580,6 @@ declare_ovr_snprint(all_tg_pt, print_yes_no_undef)
declare_hw_handler(all_tg_pt, set_yes_no_undef)
declare_hw_snprint(all_tg_pt, print_yes_no_undef)
@ -157,11 +158,24 @@ index 8321ec1e..d7cd94a5 100644
declare_def_handler(recheck_wwid, set_yes_no_undef)
declare_def_snprint_defint(recheck_wwid, print_yes_no_undef, DEFAULT_RECHECK_WWID)
declare_ovr_handler(recheck_wwid, set_yes_no_undef)
diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index 0d89e9e1..1d018eab 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -297,3 +297,8 @@ LIBMULTIPATH_9.1.1 {
global:
trigger_path_udev_change;
} LIBMULTIPATH_9.1.0;
+
+LIBMULTIPATH_9.1.2 {
+global:
+ cleanup_mutex;
+} LIBMULTIPATH_9.1.1;
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 209c1d67..be79902f 100644
index b2876670..677ab9e1 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -85,6 +85,8 @@ static const char cmdline_origin[] =
@@ -84,6 +84,8 @@ static const char cmdline_origin[] =
"(setting: multipath command line [-p] flag)";
static const char autodetect_origin[] =
"(setting: storage device autodetected)";
@ -170,9 +184,9 @@ index 209c1d67..be79902f 100644
static const char marginal_path_origin[] =
"(setting: implied by marginal_path check)";
static const char delay_watch_origin[] =
@@ -1052,9 +1054,12 @@ int select_san_path_err_threshold(struct config *conf, struct multipath *mp)
@@ -1036,9 +1038,12 @@ int select_san_path_err_threshold(struct config *conf, struct multipath *mp)
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- if (marginal_path_check_enabled(mp)) {
+ if (marginal_path_check_enabled(mp) || (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN)) {
@ -185,9 +199,9 @@ index 209c1d67..be79902f 100644
goto out;
}
mp_set_mpe(san_path_err_threshold);
@@ -1075,9 +1080,12 @@ int select_san_path_err_forget_rate(struct config *conf, struct multipath *mp)
@@ -1059,9 +1064,12 @@ int select_san_path_err_forget_rate(struct config *conf, struct multipath *mp)
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- if (marginal_path_check_enabled(mp)) {
+ if (marginal_path_check_enabled(mp) || (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN)) {
@ -200,9 +214,9 @@ index 209c1d67..be79902f 100644
goto out;
}
mp_set_mpe(san_path_err_forget_rate);
@@ -1099,9 +1107,12 @@ int select_san_path_err_recovery_time(struct config *conf, struct multipath *mp)
@@ -1083,9 +1091,12 @@ int select_san_path_err_recovery_time(struct config *conf, struct multipath *mp)
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- if (marginal_path_check_enabled(mp)) {
+ if (marginal_path_check_enabled(mp) || (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN)) {
@ -215,9 +229,9 @@ index 209c1d67..be79902f 100644
goto out;
}
mp_set_mpe(san_path_err_recovery_time);
@@ -1123,6 +1134,12 @@ int select_marginal_path_err_sample_time(struct config *conf, struct multipath *
@@ -1107,6 +1118,12 @@ int select_marginal_path_err_sample_time(struct config *conf, struct multipath *
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
+ if (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN) {
+ mp->marginal_path_err_sample_time = NU_NO;
@ -228,9 +242,9 @@ index 209c1d67..be79902f 100644
mp_set_mpe(marginal_path_err_sample_time);
mp_set_ovr(marginal_path_err_sample_time);
mp_set_hwe(marginal_path_err_sample_time);
@@ -1141,6 +1158,12 @@ int select_marginal_path_err_rate_threshold(struct config *conf, struct multipat
@@ -1130,6 +1147,12 @@ int select_marginal_path_err_rate_threshold(struct config *conf, struct multipat
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
+ if (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN) {
+ mp->marginal_path_err_rate_threshold = NU_NO;
@ -241,9 +255,9 @@ index 209c1d67..be79902f 100644
mp_set_mpe(marginal_path_err_rate_threshold);
mp_set_ovr(marginal_path_err_rate_threshold);
mp_set_hwe(marginal_path_err_rate_threshold);
@@ -1159,6 +1182,12 @@ int select_marginal_path_err_recheck_gap_time(struct config *conf, struct multip
@@ -1147,6 +1170,12 @@ int select_marginal_path_err_recheck_gap_time(struct config *conf, struct multip
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
+ if (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN) {
+ mp->marginal_path_err_recheck_gap_time = NU_NO;
@ -254,9 +268,9 @@ index 209c1d67..be79902f 100644
mp_set_mpe(marginal_path_err_recheck_gap_time);
mp_set_ovr(marginal_path_err_recheck_gap_time);
mp_set_hwe(marginal_path_err_recheck_gap_time);
@@ -1177,6 +1206,12 @@ int select_marginal_path_double_failed_time(struct config *conf, struct multipat
@@ -1165,6 +1194,12 @@ int select_marginal_path_double_failed_time(struct config *conf, struct multipat
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
+ if (conf->marginal_pathgroups == MARGINAL_PATHGROUP_FPIN) {
+ mp->marginal_path_double_failed_time = NU_NO;
@ -268,10 +282,10 @@ index 209c1d67..be79902f 100644
mp_set_ovr(marginal_path_double_failed_time);
mp_set_hwe(marginal_path_double_failed_time);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 875e726e..3ed5cfc1 100644
index 399540e7..1188363e 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -128,6 +128,12 @@ enum find_multipaths_states {
@@ -110,6 +110,12 @@ enum find_multipaths_states {
__FIND_MULTIPATHS_LAST,
};
@ -284,7 +298,7 @@ index 875e726e..3ed5cfc1 100644
enum flush_states {
FLUSH_UNDEF = YNU_UNDEF,
FLUSH_DISABLED = YNU_NO,
@@ -429,6 +435,7 @@ struct multipath {
@@ -409,6 +415,7 @@ struct multipath {
unsigned char prflag;
int all_tg_pt;
struct gen_multipath generic_mp;
@ -293,10 +307,10 @@ index 875e726e..3ed5cfc1 100644
static inline int marginal_path_check_enabled(const struct multipath *mpp)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index abbc89af..805b7a5e 100644
index 7f85f766..5ed2cd3c 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1063,20 +1063,26 @@ The default is: \fBno\fR
@@ -1088,20 +1088,26 @@ The default is: \fBno\fR
.
.TP
.B marginal_pathgroups
@ -325,8 +339,8 @@ index abbc89af..805b7a5e 100644
+See "Shaky paths detection" below for more information.
.RS
.TP
The default is: \fBno\fR
@@ -1852,6 +1858,13 @@ increase and the threshold is never reached. Ticks are the time between
The default is: \fBno\fR
@@ -1842,6 +1848,13 @@ increase and the threshold is never reached. Ticks are the time between
path checks by multipathd, which is variable and controlled by the
\fIpolling_interval\fR and \fImax_polling_interval\fR parameters.
.
@ -341,11 +355,12 @@ index abbc89af..805b7a5e 100644
.LP
This method is \fBdeprecated\fR in favor of the \(dqmarginal_path\(dq failure
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 8d901178..835edd93 100644
index 393b6cbb..cd6f7e6d 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -1,5 +1,9 @@
include ../Makefile.inc
@@ -4,6 +4,10 @@ ifneq ($(call check_func,dm_task_get_errno,/usr/include/libdevmapper.h),0)
CFLAGS += -DLIBDM_API_GET_ERRNO
endif
+ifneq ($(call check_var,ELS_DTAG_LNK_INTEGRITY,/usr/include/scsi/fc/fc_els.h),0)
+ CFLAGS += -DFPIN_EVENT_HANDLER
@ -354,9 +369,9 @@ index 8d901178..835edd93 100644
#
# debugging stuff
#
@@ -28,6 +32,12 @@ endif
@@ -34,6 +38,12 @@ endif
OBJS = main.o pidfile.o uxlsnr.o uxclnt.o cli.o cli_handlers.o waiter.o \
dmevents.o
dmevents.o init_unwinder.o
+ifeq ($(FPIN_SUPPORT),1)
+OBJS += fpin_handlers.o
@ -395,16 +410,15 @@ index 00000000..bfcc1ce2
+#endif
diff --git a/multipathd/fpin_handlers.c b/multipathd/fpin_handlers.c
new file mode 100644
index 00000000..b14366d7
index 00000000..aaf5655d
--- /dev/null
+++ b/multipathd/fpin_handlers.c
@@ -0,0 +1,541 @@
@@ -0,0 +1,540 @@
+#include <errno.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <libudev.h>
+#include <stdint.h>
+#include <scsi/scsi_netlink_fc.h>
+#include <scsi/fc/fc_els.h>
+
@ -525,10 +539,10 @@ index 00000000..b14366d7
+ }
+empty:
+ pthread_cleanup_pop(1);
+ /* walk backwards because update_path_groups() can remove mpp */
+ /* walk backwards because reload_and_sync_map() can remove mpp */
+ vector_foreach_slot_backwards(vecs->mpvec, mpp, i) {
+ if (mpp->fpin_must_reload) {
+ ret = update_path_groups(mpp, vecs, 0);
+ ret = reload_and_sync_map(mpp, vecs, 0);
+ if (ret == 2)
+ condlog(2, "map removed during reload");
+ else
@ -653,10 +667,10 @@ index 00000000..b14366d7
+unref:
+ pthread_cleanup_pop(1);
+ }
+ /* walk backwards because update_path_groups() can remove mpp */
+ /* walk backwards because reload_and_sync_map() can remove mpp */
+ vector_foreach_slot_backwards(vecs->mpvec, mpp, i) {
+ if (mpp->fpin_must_reload) {
+ ret = update_path_groups(mpp, vecs, 0);
+ ret = reload_and_sync_map(mpp, vecs, 0);
+ if (ret == 2)
+ condlog(2, "map removed during reload");
+ else
@ -941,7 +955,7 @@ index 00000000..b14366d7
+ return NULL;
+}
diff --git a/multipathd/main.c b/multipathd/main.c
index eeded52b..4cf5bc41 100644
index 5def5301..53be9b95 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -16,6 +16,7 @@
@ -952,7 +966,21 @@ index eeded52b..4cf5bc41 100644
#ifdef USE_SYSTEMD
#include <systemd/sd-daemon.h>
#endif
@@ -2704,7 +2705,9 @@ reconfigure (struct vectors * vecs)
@@ -130,9 +131,11 @@ static volatile enum daemon_status running_state = DAEMON_INIT;
pid_t daemon_pid;
static pthread_mutex_t config_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t config_cond;
-static pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr, dmevent_thr;
+static pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr, dmevent_thr,
+ fpin_thr, fpin_consumer_thr;
static bool check_thr_started, uevent_thr_started, uxlsnr_thr_started,
- uevq_thr_started, dmevent_thr_started;
+ uevq_thr_started, dmevent_thr_started, fpin_thr_started,
+ fpin_consumer_thr_started;
static int pid_fd = -1;
static inline enum daemon_status get_running_state(void)
@@ -2819,7 +2822,9 @@ reconfigure (struct vectors * vecs)
conf->sequence_nr = old->sequence_nr + 1;
rcu_assign_pointer(multipath_conf, conf);
call_rcu(&old->rcu, rcu_free_config);
@ -963,25 +991,39 @@ index eeded52b..4cf5bc41 100644
configure(vecs);
@@ -2878,7 +2881,8 @@ set_oom_adj (void)
static int
child (__attribute__((unused)) void *param)
{
- pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr, dmevent_thr;
+ pthread_t check_thr, uevent_thr, uxlsnr_thr, uevq_thr, dmevent_thr,
+ fpin_thr, fpin_consumer_thr;
pthread_attr_t log_attr, misc_attr, uevent_attr;
struct vectors * vecs;
struct multipath * mpp;
@@ -2892,6 +2896,7 @@ child (__attribute__((unused)) void *param)
@@ -3060,6 +3065,11 @@ static void cleanup_threads(void)
pthread_cancel(uevq_thr);
if (dmevent_thr_started)
pthread_cancel(dmevent_thr);
+ if (fpin_thr_started)
+ pthread_cancel(fpin_thr);
+ if (fpin_consumer_thr_started)
+ pthread_cancel(fpin_consumer_thr);
+
if (check_thr_started)
pthread_join(check_thr, NULL);
@@ -3071,6 +3081,11 @@ static void cleanup_threads(void)
pthread_join(uevq_thr, NULL);
if (dmevent_thr_started)
pthread_join(dmevent_thr, NULL);
+ if (fpin_thr_started)
+ pthread_join(fpin_thr, NULL);
+ if (fpin_consumer_thr_started)
+ pthread_join(fpin_consumer_thr, NULL);
+
/*
* As all threads are joined now, and we're in DAEMON_SHUTDOWN
@@ -3168,6 +3183,7 @@ child (__attribute__((unused)) void *param)
char *envp;
int queue_without_daemon;
enum daemon_status state;
int exit_code = 1;
+ int fpin_marginal_paths = 0;
init_unwinder();
mlockall(MCL_CURRENT | MCL_FUTURE);
signal_init();
@@ -2959,7 +2964,10 @@ child (__attribute__((unused)) void *param)
@@ -3246,7 +3262,10 @@ child (__attribute__((unused)) void *param)
setscheduler();
set_oom_adj();
@ -993,45 +1035,26 @@ index eeded52b..4cf5bc41 100644
/*
* Startup done, invalidate configuration
*/
@@ -3020,6 +3028,19 @@ child (__attribute__((unused)) void *param)
condlog(0, "failed to create uevent dispatcher: %d", rc);
@@ -3314,6 +3333,22 @@ child (__attribute__((unused)) void *param)
goto failed;
}
} else
uevq_thr_started = true;
+
+ if (fpin_marginal_paths) {
+ if ((rc = pthread_create(&fpin_thr, &misc_attr,
+ fpin_fabric_notification_receiver, NULL))) {
+ condlog(0, "failed to create the fpin receiver thread: %d", rc);
+ goto failed;
+ }
+ } else
+ fpin_thr_started = true;
+
+ if ((rc = pthread_create(&fpin_consumer_thr,
+ &misc_attr, fpin_els_li_consumer, vecs))) {
+ condlog(0, "failed to create the fpin consumer thread thread: %d", rc);
+ goto failed;
+ }
+ } else
+ fpin_consumer_thr_started = true;
+ }
pthread_attr_destroy(&misc_attr);
while (1) {
@@ -3070,6 +3091,10 @@ child (__attribute__((unused)) void *param)
pthread_cancel(uevq_thr);
if (poll_dmevents)
pthread_cancel(dmevent_thr);
+ if (fpin_marginal_paths) {
+ pthread_cancel(fpin_thr);
+ pthread_cancel(fpin_consumer_thr);
+ }
pthread_join(check_thr, NULL);
pthread_join(uevent_thr, NULL);
@@ -3077,6 +3102,10 @@ child (__attribute__((unused)) void *param)
pthread_join(uevq_thr, NULL);
if (poll_dmevents)
pthread_join(dmevent_thr, NULL);
+ if (fpin_marginal_paths) {
+ pthread_join(fpin_thr, NULL);
+ pthread_join(fpin_consumer_thr, NULL);
+ }
stop_io_err_stat_thread();

View File

@ -17,10 +17,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 805b7a5e..8e418372 100644
index 5ed2cd3c..58ad5c9c 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1077,15 +1077,18 @@ have been tried first. This prevents the possibility of IO errors occuring
@@ -1102,15 +1102,18 @@ have been tried first. This prevents the possibility of IO errors occuring
while marginal paths are still usable. After the path has been monitored
for the configured time, and is declared healthy, it will be returned to its
normal pathgroup.
@ -39,16 +39,16 @@ index 805b7a5e..8e418372 100644
See "Shaky paths detection" below for more information.
.RS
.TP
-The default is: \fBno\fR
-The default is: \fBno\fR
+The default is: \fBoff\fR
.RE
.
.
diff --git a/multipathd/main.c b/multipathd/main.c
index 4cf5bc41..a6ffbe32 100644
index 53be9b95..45b9572f 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2675,6 +2675,7 @@ int
@@ -2792,6 +2792,7 @@ int
reconfigure (struct vectors * vecs)
{
struct config * old, *conf;
@ -56,7 +56,7 @@ index 4cf5bc41..a6ffbe32 100644
conf = load_config(DEFAULT_CONFIGFILE);
if (!conf)
@@ -2702,6 +2703,14 @@ reconfigure (struct vectors * vecs)
@@ -2819,6 +2820,14 @@ reconfigure (struct vectors * vecs)
uxsock_timeout = conf->uxsock_timeout;
old = rcu_dereference(multipath_conf);

View File

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 16 Feb 2022 00:12:29 -0600
Subject: [PATCH] libmultipath: fix printing native nvme multipath topology.
Since commit 2f05df4 ("libmultipath: use strbuf in print.c"), when
multipath prints the topology of native nvme devices, instead of
printing the multipath device information, it prints "w [G]:d s". This
is because nvme_style() switched from calling snprintf(), which supports
format specifiers, to append_strbuf_str(), which doesn't, while still
keeping the same string, "%%w [%%G]:%%d %%s". Remove the extra percent
signs, since they don't need to be escaped in append_strbuf_str().
Fixes: 2f05df4 ("libmultipath: use strbuf in print.c")
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/foreign/nvme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/foreign/nvme.c b/libmultipath/foreign/nvme.c
index d40c0869..23355ca5 100644
--- a/libmultipath/foreign/nvme.c
+++ b/libmultipath/foreign/nvme.c
@@ -335,7 +335,7 @@ static int snprint_nvme_pg(const struct gen_pathgroup *gmp,
static int nvme_style(__attribute__((unused)) const struct gen_multipath* gm,
struct strbuf *buf, __attribute__((unused)) int verbosity)
{
- return append_strbuf_str(buf, "%%w [%%G]:%%d %%s");
+ return append_strbuf_str(buf, "%w [%G]:%d %s");
}
static const struct gen_multipath_ops nvme_map_ops = {

View File

@ -0,0 +1,86 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 29 Mar 2022 22:22:10 -0500
Subject: [PATCH] multipathd: Don't keep starting TUR threads, if they always
hang.
If tur thead hangs, multipathd was simply creating a new thread, and
assuming that the old thread would get cleaned up eventually. I have
seen a case recently where there were 26000 multipathd threads on a
system, all stuck trying to send TUR commands to path devices. The root
cause of the issue was a scsi kernel issue, but it shows that the way
multipathd currently deals with stuck threads could use some refinement.
Now, when one tur thread hangs, multipathd will act as it did before.
If a second one in a row hangs, multipathd will instead wait for it to
complete before starting another thread. Once the thread completes, the
count is reset.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com
---
libmultipath/checkers/tur.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/libmultipath/checkers/tur.c b/libmultipath/checkers/tur.c
index a4b4a213..d82f7dbc 100644
--- a/libmultipath/checkers/tur.c
+++ b/libmultipath/checkers/tur.c
@@ -27,6 +27,7 @@
#define TUR_CMD_LEN 6
#define HEAVY_CHECK_COUNT 10
+#define MAX_NR_TIMEOUTS 1
enum {
MSG_TUR_RUNNING = CHECKER_FIRST_MSGID,
@@ -55,6 +56,7 @@ struct tur_checker_context {
int holders; /* uatomic access only */
int msgid;
struct checker_context ctx;
+ unsigned int nr_timeouts;
};
int libcheck_init (struct checker * c)
@@ -359,8 +361,23 @@ int libcheck_check(struct checker * c)
}
} else {
if (uatomic_read(&ct->holders) > 1) {
+ /* The thread has been cancelled but hasn't quit. */
+ if (ct->nr_timeouts == MAX_NR_TIMEOUTS) {
+ condlog(2, "%d:%d : waiting for stalled tur thread to finish",
+ major(ct->devt), minor(ct->devt));
+ ct->nr_timeouts++;
+ }
/*
- * The thread has been cancelled but hasn't quit.
+ * Don't start new threads until the last once has
+ * finished.
+ */
+ if (ct->nr_timeouts > MAX_NR_TIMEOUTS) {
+ c->msgid = MSG_TUR_TIMEOUT;
+ return PATH_TIMEOUT;
+ }
+ ct->nr_timeouts++;
+ /*
+ * Start a new thread while the old one is stalled.
* We have to prevent it from interfering with the new
* thread. We create a new context and leave the old
* one with the stale thread, hoping it will clean up
@@ -376,13 +393,15 @@ int libcheck_check(struct checker * c)
*/
if (libcheck_init(c) != 0)
return PATH_UNCHECKED;
+ ((struct tur_checker_context *)c->context)->nr_timeouts = ct->nr_timeouts;
if (!uatomic_sub_return(&ct->holders, 1))
/* It did terminate, eventually */
cleanup_context(ct);
ct = c->context;
- }
+ } else
+ ct->nr_timeouts = 0;
/* Start new TUR checker */
pthread_mutex_lock(&ct->lock);
tur_status = ct->state = PATH_PENDING;

View File

@ -40,10 +40,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index 3f70e576..e3c3c119 100644
index c05dc201..1ff75c81 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -420,7 +420,7 @@ int dm_addmap_create (struct multipath *mpp, char * params)
@@ -542,7 +542,7 @@ int dm_addmap_create (struct multipath *mpp, char * params)
int ro;
uint16_t udev_flags = build_udev_flags(mpp, 0);
@ -53,10 +53,10 @@ index 3f70e576..e3c3c119 100644
if (dm_addmap(DM_DEVICE_CREATE, TGT_MPATH, mpp, params, ro,
diff --git a/multipathd/main.c b/multipathd/main.c
index f4b79882..eeded52b 100644
index 45b9572f..ed2515e5 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -988,6 +988,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
@@ -1048,6 +1048,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int retries = 3;
int start_waiter = 0;
int ret;
@ -64,7 +64,7 @@ index f4b79882..eeded52b 100644
/*
* need path UID to go any further
@@ -1051,6 +1052,11 @@ rescan:
@@ -1112,6 +1113,11 @@ rescan:
/* persistent reservation check*/
mpath_pr_event_handle(pp);

View File

@ -18,10 +18,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com
1 file changed, 5 insertions(+)
diff --git a/multipath/main.c b/multipath/main.c
index 14d045c9..d5e6499c 100644
index 80fa68e5..41d01c7e 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -1150,6 +1150,11 @@ main (int argc, char *argv[])
@@ -1111,6 +1111,11 @@ main (int argc, char *argv[])
if (retries < 0)
retries = conf->remove_retries;
if (cmd == CMD_FLUSH_ONE) {

View File

@ -14,10 +14,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index abbddaf1..aa79561e 100644
index cee3bbb7..005d6b54 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -323,9 +323,9 @@ set_param_str(const char * str)
@@ -388,9 +388,9 @@ set_param_str(const char * str)
}
#define merge_str(s) \
@ -30,7 +30,7 @@ index abbddaf1..aa79561e 100644
}
#define merge_num(s) \
@@ -333,7 +333,7 @@ set_param_str(const char * str)
@@ -398,7 +398,7 @@ set_param_str(const char * str)
dst->s = src->s
@ -39,7 +39,7 @@ index abbddaf1..aa79561e 100644
merge_hwe (struct hwentry * dst, struct hwentry * src)
{
char id[SCSI_VENDOR_SIZE+PATH_PRODUCT_SIZE];
@@ -385,15 +385,11 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
@@ -450,15 +450,11 @@ merge_hwe (struct hwentry * dst, struct hwentry * src)
reconcile_features_with_options(id, &dst->features,
&dst->no_path_retry,
&dst->retain_hwhandler);
@ -56,7 +56,7 @@ index abbddaf1..aa79561e 100644
merge_str(alias);
merge_str(uid_attribute);
merge_str(getuid);
@@ -435,8 +431,6 @@ merge_mpe(struct mpentry *dst, struct mpentry *src)
@@ -500,8 +496,6 @@ merge_mpe(struct mpentry *dst, struct mpentry *src)
merge_num(uid);
merge_num(gid);
merge_num(mode);

View File

@ -13,14 +13,14 @@ Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs.c | 10 ++++++++++
libmultipath/structs.h | 14 ++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
libmultipath/structs.h | 13 +++++++++++--
2 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index dda9884c..aaf85297 100644
index 6e5a1038..2b7cde0c 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -722,3 +722,13 @@ out:
@@ -758,3 +758,13 @@ out:
return 0;
}
@ -35,10 +35,10 @@ index dda9884c..aaf85297 100644
+ return SYSFS_BUS_SCSI + pp->sg_id.proto_id;
+}
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index a5dbad5b..5e29ae38 100644
index 1188363e..45294f11 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -57,12 +57,13 @@ enum failback_mode {
@@ -56,12 +56,13 @@ enum failback_mode {
FAILBACK_FOLLOWOVER
};
@ -53,12 +53,11 @@ index a5dbad5b..5e29ae38 100644
};
enum pathstates {
@@ -190,9 +191,18 @@ enum scsi_protocol {
SCSI_PROTOCOL_SAS = 6,
@@ -180,9 +181,17 @@ enum scsi_protocol {
SCSI_PROTOCOL_ADT = 7, /* Media Changers */
SCSI_PROTOCOL_ATA = 8,
SCSI_PROTOCOL_USB = 9, /* USB Attached SCSI (UAS), and others */
- SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
+ SCSI_PROTOCOL_USB = 9, /* USB Attached SCSI (UAS), and others */
+ SCSI_PROTOCOL_UNSPEC = 0xa, /* No specific protocol */
};
@ -70,6 +69,6 @@ index a5dbad5b..5e29ae38 100644
+#define LAST_BUS_PROTOCOL_ID (SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC)
+unsigned int bus_protocol_id(const struct path *pp);
+
#define SCSI_INVALID_LUN ~0ULL
enum no_undef_states {
NU_NO = -1,
NU_UNDEF = 0,

View File

@ -10,51 +10,53 @@ Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/print.c | 56 +++++++++++++++++---------------------------
1 file changed, 21 insertions(+), 35 deletions(-)
libmultipath/print.c | 58 ++++++++++++++++----------------------------
1 file changed, 21 insertions(+), 37 deletions(-)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 298b3764..ff4d1854 100644
index 2fb9f4ef..8f1b18db 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -662,41 +662,27 @@ snprint_path_failures(char * buff, size_t len, const struct path * pp)
@@ -696,43 +696,27 @@ snprint_path_failures(struct strbuf *buff, const struct path * pp)
int
snprint_path_protocol(char * buff, size_t len, const struct path * pp)
snprint_path_protocol(struct strbuf *buff, const struct path * pp)
{
- switch (pp->bus) {
- case SYSFS_BUS_SCSI:
- switch (pp->sg_id.proto_id) {
- case SCSI_PROTOCOL_FCP:
- return snprintf(buff, len, "scsi:fcp");
- return append_strbuf_str(buff, "scsi:fcp");
- case SCSI_PROTOCOL_SPI:
- return snprintf(buff, len, "scsi:spi");
- return append_strbuf_str(buff, "scsi:spi");
- case SCSI_PROTOCOL_SSA:
- return snprintf(buff, len, "scsi:ssa");
- return append_strbuf_str(buff, "scsi:ssa");
- case SCSI_PROTOCOL_SBP:
- return snprintf(buff, len, "scsi:sbp");
- return append_strbuf_str(buff, "scsi:sbp");
- case SCSI_PROTOCOL_SRP:
- return snprintf(buff, len, "scsi:srp");
- return append_strbuf_str(buff, "scsi:srp");
- case SCSI_PROTOCOL_ISCSI:
- return snprintf(buff, len, "scsi:iscsi");
- return append_strbuf_str(buff, "scsi:iscsi");
- case SCSI_PROTOCOL_SAS:
- return snprintf(buff, len, "scsi:sas");
- return append_strbuf_str(buff, "scsi:sas");
- case SCSI_PROTOCOL_ADT:
- return snprintf(buff, len, "scsi:adt");
- return append_strbuf_str(buff, "scsi:adt");
- case SCSI_PROTOCOL_ATA:
- return snprintf(buff, len, "scsi:ata");
- return append_strbuf_str(buff, "scsi:ata");
- case SCSI_PROTOCOL_USB:
- return append_strbuf_str(buff, "scsi:usb");
- case SCSI_PROTOCOL_UNSPEC:
- default:
- return snprintf(buff, len, "scsi:unspec");
- return append_strbuf_str(buff, "scsi:unspec");
- }
- case SYSFS_BUS_CCW:
- return snprintf(buff, len, "ccw");
- return append_strbuf_str(buff, "ccw");
- case SYSFS_BUS_CCISS:
- return snprintf(buff, len, "cciss");
- return append_strbuf_str(buff, "cciss");
- case SYSFS_BUS_NVME:
- return snprintf(buff, len, "nvme");
- return append_strbuf_str(buff, "nvme");
- case SYSFS_BUS_UNDEF:
- default:
- return snprintf(buff, len, "undef");
- return append_strbuf_str(buff, "undef");
- }
+ static const char * const protocol_name[LAST_BUS_PROTOCOL_ID + 1] = {
+ [SYSFS_BUS_UNDEF] = "undef",
@ -76,7 +78,7 @@ index 298b3764..ff4d1854 100644
+ const char *pn = protocol_name[bus_protocol_id(pp)];
+
+ assert(pn != NULL);
+ return snprintf(buff, len, "%s", pn);
+ return append_strbuf_str(buff, pn);
}
int

View File

@ -15,12 +15,12 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index ff4d1854..1f6d27bd 100644
index 8f1b18db..0dbd34e4 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -662,23 +662,6 @@ snprint_path_failures(char * buff, size_t len, const struct path * pp)
@@ -696,23 +696,6 @@ snprint_path_failures(struct strbuf *buff, const struct path * pp)
int
snprint_path_protocol(char * buff, size_t len, const struct path * pp)
snprint_path_protocol(struct strbuf *buff, const struct path * pp)
{
- static const char * const protocol_name[LAST_BUS_PROTOCOL_ID + 1] = {
- [SYSFS_BUS_UNDEF] = "undef",
@ -43,7 +43,7 @@ index ff4d1854..1f6d27bd 100644
assert(pn != NULL);
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index aaf85297..19099bed 100644
index 2b7cde0c..d20e1eea 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -20,6 +20,24 @@
@ -72,14 +72,14 @@ index aaf85297..19099bed 100644
alloc_adaptergroup(void)
{
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 5e29ae38..ab99852f 100644
index 45294f11..618ff4fb 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -202,6 +202,7 @@ enum scsi_protocol {
@@ -191,6 +191,7 @@ enum scsi_protocol {
*/
#define LAST_BUS_PROTOCOL_ID (SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC)
unsigned int bus_protocol_id(const struct path *pp);
+extern const char * const protocol_name[];
enum no_undef_states {
NU_NO = -1,
#define SCSI_INVALID_LUN ~0ULL

View File

@ -17,14 +17,14 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
libmultipath/config.c | 83 ++++++++++++++++++++++++++++++++++++
libmultipath/config.h | 10 +++++
libmultipath/dict.c | 99 +++++++++++++++++++++++++++++++++++++++++++
libmultipath/print.c | 44 +++++++++++++++++++
4 files changed, 236 insertions(+)
libmultipath/print.c | 50 ++++++++++++++++++++++
4 files changed, 242 insertions(+)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index aa79561e..88975323 100644
index 005d6b54..8b0e1f72 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -173,6 +173,18 @@ char *get_mpe_wwid(vector mptable, char *alias)
@@ -238,6 +238,18 @@ const char *get_mpe_wwid(const struct _vector *mptable, const char *alias)
return NULL;
}
@ -43,7 +43,7 @@ index aa79561e..88975323 100644
void
free_hwe (struct hwentry * hwe)
{
@@ -218,6 +230,9 @@ free_hwe (struct hwentry * hwe)
@@ -283,6 +295,9 @@ free_hwe (struct hwentry * hwe)
if (hwe->bl_product)
FREE(hwe->bl_product);
@ -53,7 +53,7 @@ index aa79561e..88975323 100644
FREE(hwe);
}
@@ -299,6 +314,15 @@ alloc_hwe (void)
@@ -364,6 +379,15 @@ alloc_hwe (void)
return hwe;
}
@ -69,7 +69,7 @@ index aa79561e..88975323 100644
static char *
set_param_str(const char * str)
{
@@ -332,6 +356,13 @@ set_param_str(const char * str)
@@ -397,6 +421,13 @@ set_param_str(const char * str)
if (!dst->s && src->s) \
dst->s = src->s
@ -83,7 +83,7 @@ index aa79561e..88975323 100644
static void
merge_hwe (struct hwentry * dst, struct hwentry * src)
@@ -538,6 +569,51 @@ out:
@@ -603,6 +634,51 @@ out:
return 1;
}
@ -135,7 +135,7 @@ index aa79561e..88975323 100644
static void
factorize_hwtable (vector hw, int n, const char *table_desc)
{
@@ -666,6 +742,7 @@ process_config_dir(struct config *conf, char *dir)
@@ -751,6 +827,7 @@ process_config_dir(struct config *conf, char *dir)
int i, n;
char path[LINE_MAX];
int old_hwtable_size;
@ -143,7 +143,7 @@ index aa79561e..88975323 100644
if (dir[0] != '/') {
condlog(1, "config_dir '%s' must be a fully qualified path",
@@ -692,11 +769,15 @@ process_config_dir(struct config *conf, char *dir)
@@ -777,11 +854,15 @@ process_config_dir(struct config *conf, char *dir)
continue;
old_hwtable_size = VECTOR_SIZE(conf->hwtable);
@ -159,7 +159,7 @@ index aa79561e..88975323 100644
}
pthread_cleanup_pop(1);
}
@@ -784,6 +865,7 @@ load_config (char * file)
@@ -889,6 +970,7 @@ int _init_config (const char *file, struct config *conf)
goto out;
}
factorize_hwtable(conf->hwtable, builtin_hwtable_size, file);
@ -167,7 +167,7 @@ index aa79561e..88975323 100644
} else {
condlog(0, "/etc/multipath.conf does not exist, blacklisting all devices.");
condlog(0, "You can run \"/sbin/mpathconf --enable\" to create");
@@ -898,6 +980,7 @@ load_config (char * file)
@@ -1004,6 +1086,7 @@ int _init_config (const char *file, struct config *conf)
goto out;
}
@ -176,7 +176,7 @@ index aa79561e..88975323 100644
merge_blacklist(conf->blist_devnode);
merge_blacklist(conf->blist_property);
diff --git a/libmultipath/config.h b/libmultipath/config.h
index e2e3f143..143116b3 100644
index 5f01c1fc..57992604 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -41,6 +41,13 @@ enum force_reload_types {
@ -202,7 +202,7 @@ index e2e3f143..143116b3 100644
};
struct mpentry {
@@ -240,6 +249,7 @@ char * get_mpe_wwid (vector mptable, char * alias);
@@ -286,6 +295,7 @@ const char *get_mpe_wwid (const struct _vector *mptable, const char *alias);
struct hwentry * alloc_hwe (void);
struct mpentry * alloc_mpe (void);
@ -211,11 +211,11 @@ index e2e3f143..143116b3 100644
void free_hwe (struct hwentry * hwe);
void free_hwtable (vector hwtable);
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 5a0255b0..8321ec1e 100644
index eb5a8083..46b9f225 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -457,6 +457,29 @@ snprint_mp_ ## option (struct config *conf, char * buff, int len, \
return function (buff, len, mpe->option); \
@@ -414,6 +414,29 @@ snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \
return function(buff, mpe->option); \
}
+#define declare_pc_handler(option, function) \
@ -234,17 +234,17 @@ index 5a0255b0..8321ec1e 100644
+
+#define declare_pc_snprint(option, function) \
+static int \
+snprint_pc_ ## option (struct config *conf, char * buff, int len, \
+snprint_pc_ ## option (struct config *conf, struct strbuf *buff, \
+ const void *data) \
+{ \
+ const struct pcentry *pce = (const struct pcentry *)data; \
+ return function(buff, len, pce->option); \
+ return function(buff, pce->option); \
+}
+
static int checkint_handler(struct config *conf, vector strvec,
const char *file, int line_nr)
{
@@ -1022,6 +1045,8 @@ declare_ovr_handler(fast_io_fail, set_undef_off_zero)
@@ -1038,6 +1061,8 @@ declare_ovr_handler(fast_io_fail, set_undef_off_zero)
declare_ovr_snprint(fast_io_fail, print_undef_off_zero)
declare_hw_handler(fast_io_fail, set_undef_off_zero)
declare_hw_snprint(fast_io_fail, print_undef_off_zero)
@ -253,7 +253,7 @@ index 5a0255b0..8321ec1e 100644
static int
set_dev_loss(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1059,6 +1084,8 @@ declare_ovr_handler(dev_loss, set_dev_loss)
@@ -1075,6 +1100,8 @@ declare_ovr_handler(dev_loss, set_dev_loss)
declare_ovr_snprint(dev_loss, print_dev_loss)
declare_hw_handler(dev_loss, set_dev_loss)
declare_hw_snprint(dev_loss, print_dev_loss)
@ -262,7 +262,7 @@ index 5a0255b0..8321ec1e 100644
declare_def_handler(eh_deadline, set_undef_off_zero)
declare_def_snprint(eh_deadline, print_undef_off_zero)
@@ -1066,6 +1093,8 @@ declare_ovr_handler(eh_deadline, set_undef_off_zero)
@@ -1082,6 +1109,8 @@ declare_ovr_handler(eh_deadline, set_undef_off_zero)
declare_ovr_snprint(eh_deadline, print_undef_off_zero)
declare_hw_handler(eh_deadline, set_undef_off_zero)
declare_hw_snprint(eh_deadline, print_undef_off_zero)
@ -271,7 +271,7 @@ index 5a0255b0..8321ec1e 100644
static int
set_pgpolicy(vector strvec, void *ptr, const char *file, int line_nr)
@@ -1876,6 +1905,69 @@ declare_mp_snprint(wwid, print_str)
@@ -1889,6 +1918,69 @@ declare_mp_snprint(wwid, print_str)
declare_mp_handler(alias, set_str_noslash)
declare_mp_snprint(alias, print_str)
@ -328,11 +328,11 @@ index 5a0255b0..8321ec1e 100644
+}
+
+static int
+print_protocol_type(char *buff, int len, int type)
+print_protocol_type(struct strbuf *buff, int type)
+{
+ if (type < 0)
+ return 0;
+ return snprintf(buff, len, "\"%s\"", protocol_name[type]);
+ return append_strbuf_quoted(buff, protocol_name[type]);
+}
+
+declare_pc_handler(type, set_protocol_type)
@ -341,7 +341,7 @@ index 5a0255b0..8321ec1e 100644
/*
* deprecated handlers
*/
@@ -2117,6 +2209,13 @@ init_keywords(vector keywords)
@@ -2130,6 +2222,13 @@ init_keywords(vector keywords)
install_keyword("ghost_delay", &ovr_ghost_delay_handler, &snprint_ovr_ghost_delay);
install_keyword("all_tg_pt", &ovr_all_tg_pt_handler, &snprint_ovr_all_tg_pt);
install_keyword("recheck_wwid", &ovr_recheck_wwid_handler, &snprint_ovr_recheck_wwid);
@ -356,64 +356,70 @@ index 5a0255b0..8321ec1e 100644
install_keyword_root("multipaths", &multipaths_handler);
install_keyword_multi("multipath", &multipath_handler, NULL);
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 1f6d27bd..8a6fbe83 100644
index 0dbd34e4..46e3d32e 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1392,6 +1392,39 @@ snprint_multipath_topology_json (char * buff, int len, const struct vectors * ve
return fwd;
@@ -1318,6 +1318,52 @@ int snprint_multipath_topology_json (struct strbuf *buff,
return get_strbuf_len(buff) - initial_len;
}
+static int
+snprint_pcentry (const struct config *conf, char *buff, int len,
+snprint_pcentry (const struct config *conf, struct strbuf *buff,
+ const struct pcentry *pce)
+{
+ int i;
+ int fwd = 0;
+ int i, rc;
+ struct keyword *kw;
+ struct keyword *rootkw;
+ struct keyword * rootkw;
+ size_t initial_len = get_strbuf_len(buff);
+
+ rootkw = find_keyword(conf->keywords, NULL, "overrides");
+ if (!rootkw || !rootkw->sub)
+ return 0;
+
+ assert(rootkw && rootkw->sub);
+ rootkw = find_keyword(conf->keywords, rootkw->sub, "protocol");
+ if (!rootkw)
+ return 0;
+ assert(rootkw);
+
+ fwd += snprintf(buff + fwd, len - fwd, "\tprotocol {\n");
+ if (fwd >= len)
+ return len;
+ if ((rc = append_strbuf_str(buff, "\tprotocol {\n")) < 0)
+ return rc;
+
+ iterate_sub_keywords(rootkw, kw, i) {
+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n",
+ kw, pce);
+ if (fwd >= len)
+ return len;
+ if ((rc = snprint_keyword(buff, "\t\t%k %v\n", kw, pce)) < 0)
+ return rc;
+ }
+ fwd += snprintf(buff + fwd, len - fwd, "\t}\n");
+ if (fwd >= len)
+ return len;
+ return fwd;
+
+ if ((rc = append_strbuf_str(buff, "\t}\n")) < 0)
+ return rc;
+ return get_strbuf_len(buff) - initial_len;
+}
+
+static int
+snprint_pctable (const struct config *conf, struct strbuf *buff,
+ const struct _vector *pctable)
+{
+ int i, rc;
+ struct pcentry *pce;
+ struct keyword * rootkw;
+ size_t initial_len = get_strbuf_len(buff);
+
+ rootkw = find_keyword(conf->keywords, NULL, "overrides");
+ assert(rootkw);
+
+ vector_foreach_slot(pctable, pce, i) {
+ if ((rc = snprint_pcentry(conf, buff, pce)) < 0)
+ return rc;
+ }
+ return get_strbuf_len(buff) - initial_len;
+}
+
static int
snprint_hwentry (const struct config *conf,
char * buff, int len, const struct hwentry * hwe)
@@ -1575,6 +1608,17 @@ static int snprint_overrides(const struct config *conf, char * buff, int len,
if (fwd >= len)
return len;
struct strbuf *buff, const struct hwentry * hwe)
@@ -1472,6 +1518,10 @@ static int snprint_overrides(const struct config *conf, struct strbuf *buff,
if ((rc = snprint_keyword(buff, "\t%k %v\n", kw, NULL)) < 0)
return rc;
}
+
+ if (overrides->pctable) {
+ struct pcentry *pce;
+
+ vector_foreach_slot(overrides->pctable, pce, i) {
+ fwd += snprint_pcentry(conf, buff + fwd, len - fwd,
+ pce);
+ if (fwd >= len)
+ return len;
+ }
+ }
+ if (overrides->pctable &&
+ (rc = snprint_pctable(conf, buff, overrides->pctable)) < 0)
+ return rc;
out:
fwd += snprintf(buff + fwd, len - fwd, "}\n");
if (fwd >= len)
if ((rc = append_strbuf_str(buff, "}\n")) < 0)
return rc;

View File

@ -14,19 +14,19 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/configure.c | 5 +-
libmultipath/discovery.c | 149 +++++++++++++++++++++++----------------
libmultipath/discovery.c | 158 ++++++++++++++++++++-------------------
libmultipath/discovery.h | 2 +-
libmultipath/propsel.c | 42 +++++------
libmultipath/propsel.h | 6 +-
libmultipath/structs.c | 1 -
libmultipath/structs.h | 6 +-
7 files changed, 118 insertions(+), 93 deletions(-)
7 files changed, 112 insertions(+), 108 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 9a9890f5..6cad0468 100644
index 043e4232..70049f47 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -338,9 +338,6 @@ int setup_map(struct multipath *mpp, char *params, int params_size,
@@ -365,9 +365,6 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
select_mode(conf, mpp);
select_uid(conf, mpp);
select_gid(conf, mpp);
@ -36,7 +36,7 @@ index 9a9890f5..6cad0468 100644
select_reservation_key(conf, mpp);
select_deferred_remove(conf, mpp);
select_marginal_path_err_sample_time(conf, mpp);
@@ -356,7 +353,7 @@ int setup_map(struct multipath *mpp, char *params, int params_size,
@@ -383,7 +380,7 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
select_ghost_delay(conf, mpp);
select_flush_on_last_del(conf, mpp);
@ -46,10 +46,10 @@ index 9a9890f5..6cad0468 100644
pthread_cleanup_pop(1);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 2404cb87..36cc389e 100644
index 6fb81c28..bcda8b09 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -581,13 +581,13 @@ sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen)
@@ -596,13 +596,13 @@ sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen)
}
static int
@ -58,40 +58,41 @@ index 2404cb87..36cc389e 100644
{
struct udev_device *hostdev;
char host_name[HOST_NAME_LEN], value[16];
int ret;
int ret, len;
- if (mpp->eh_deadline == EH_DEADLINE_UNSET)
+ if (pp->eh_deadline == EH_DEADLINE_UNSET)
return 0;
sprintf(host_name, "host%d", pp->sg_id.host_no);
@@ -596,12 +596,12 @@ sysfs_set_eh_deadline(struct multipath *mpp, struct path *pp)
@@ -611,12 +611,12 @@ sysfs_set_eh_deadline(struct multipath *mpp, struct path *pp)
if (!hostdev)
return 1;
- if (mpp->eh_deadline == EH_DEADLINE_OFF)
+ if (pp->eh_deadline == EH_DEADLINE_OFF)
sprintf(value, "off");
len = sprintf(value, "off");
- else if (mpp->eh_deadline == EH_DEADLINE_ZERO)
+ else if (pp->eh_deadline == EH_DEADLINE_ZERO)
sprintf(value, "0");
len = sprintf(value, "0");
else
- snprintf(value, 16, "%u", mpp->eh_deadline);
+ snprintf(value, 16, "%u", pp->eh_deadline);
- len = sprintf(value, "%d", mpp->eh_deadline);
+ len = sprintf(value, "%d", pp->eh_deadline);
ret = sysfs_attr_set_value(hostdev, "eh_deadline",
value, strlen(value));
@@ -625,6 +625,9 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
value, len + 1);
@@ -640,8 +640,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
unsigned int tmo;
int ret;
+ if (!pp->dev_loss && pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
+ return;
+
- if (mpp->dev_loss == DEV_LOSS_TMO_UNSET &&
- mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
+ if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
+ pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
return;
sprintf(rport_id, "rport-%d:%d-%d",
pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
rport_dev = udev_device_new_from_subsystem_sysname(udev,
@@ -664,14 +667,14 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
@@ -683,14 +683,14 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
* then set fast_io_fail, and _then_ set dev_loss_tmo
* to the correct value.
*/
@ -111,7 +112,7 @@ index 2404cb87..36cc389e 100644
ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
value, strlen(value));
if (ret <= 0) {
@@ -685,20 +688,20 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
@@ -704,20 +704,20 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
goto out;
}
}
@ -119,7 +120,7 @@ index 2404cb87..36cc389e 100644
- mpp->no_path_retry != NO_PATH_RETRY_QUEUE) {
+ } else if (pp->dev_loss > DEFAULT_DEV_LOSS_TMO &&
+ mpp->no_path_retry != NO_PATH_RETRY_QUEUE) {
condlog(3, "%s: limiting dev_loss_tmo to %d, since "
condlog(2, "%s: limiting dev_loss_tmo to %d, since "
"fast_io_fail is not set",
rport_id, DEFAULT_DEV_LOSS_TMO);
- mpp->dev_loss = DEFAULT_DEV_LOSS_TMO;
@ -139,18 +140,18 @@ index 2404cb87..36cc389e 100644
ret = sysfs_attr_set_value(rport_dev, "fast_io_fail_tmo",
value, strlen(value));
if (ret <= 0) {
@@ -709,8 +712,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
@@ -728,8 +728,8 @@ sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
rport_id, value, -ret);
}
}
- if (mpp->dev_loss > 0) {
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET) {
- snprintf(value, 16, "%u", mpp->dev_loss);
+ if (pp->dev_loss > 0) {
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET) {
+ snprintf(value, 16, "%u", pp->dev_loss);
ret = sysfs_attr_set_value(rport_dev, "dev_loss_tmo",
value, strlen(value));
if (ret <= 0) {
@@ -726,7 +729,7 @@ out:
@@ -745,15 +745,15 @@ out:
}
static void
@ -159,14 +160,20 @@ index 2404cb87..36cc389e 100644
{
struct udev_device *session_dev = NULL;
char session_id[64];
@@ -743,18 +746,18 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
char value[11];
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET)
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET)
condlog(3, "%s: ignoring dev_loss_tmo on iSCSI", pp->dev);
- if (mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
+ if (pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
return;
sprintf(session_id, "session%d", pp->sg_id.transport_id);
@@ -767,15 +767,15 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no,
pp->sg_id.channel, pp->sg_id.scsi_id, session_id);
- if (mpp->dev_loss) {
+ if (pp->dev_loss) {
condlog(3, "%s: ignoring dev_loss_tmo on iSCSI", pp->dev);
}
- if (mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
- if (mpp->fast_io_fail == MP_FAST_IO_FAIL_OFF) {
+ if (pp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
@ -183,35 +190,35 @@ index 2404cb87..36cc389e 100644
if (sysfs_attr_set_value(session_dev, "recovery_tmo",
value, strlen(value)) <= 0) {
condlog(3, "%s: Failed to set recovery_tmo, "
@@ -767,12 +770,15 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
@@ -788,14 +788,14 @@ sysfs_set_session_tmo(struct multipath *mpp, struct path *pp)
}
static void
-sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
+sysfs_set_nexus_loss_tmo(struct path *pp)
{
struct udev_device *sas_dev = NULL;
char end_dev_id[64];
struct udev_device *parent, *sas_dev = NULL;
const char *end_dev_id = NULL;
char value[11];
static const char ed_str[] = "end_device-";
+ if (!pp->udev || !pp->dev_loss)
+ return;
+
sprintf(end_dev_id, "end_device-%d:%d",
pp->sg_id.host_no, pp->sg_id.transport_id);
sas_dev = udev_device_new_from_subsystem_sysname(udev,
@@ -785,8 +791,8 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
- if (!pp->udev || mpp->dev_loss == DEV_LOSS_TMO_UNSET)
+ if (!pp->udev || pp->dev_loss == DEV_LOSS_TMO_UNSET)
return;
for (parent = udev_device_get_parent(pp->udev);
@@ -822,8 +822,8 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
condlog(4, "target%d:%d:%d -> %s", pp->sg_id.host_no,
pp->sg_id.channel, pp->sg_id.scsi_id, end_dev_id);
- if (mpp->dev_loss) {
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET) {
- snprintf(value, 11, "%u", mpp->dev_loss);
+ if (pp->dev_loss) {
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET) {
+ snprintf(value, 11, "%u", pp->dev_loss);
if (sysfs_attr_set_value(sas_dev, "I_T_nexus_loss_timeout",
value, strlen(value)) <= 0)
condlog(3, "%s: failed to update "
@@ -798,53 +804,76 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
@@ -835,47 +835,59 @@ sysfs_set_nexus_loss_tmo(struct multipath *mpp, struct path *pp)
}
int
@ -221,6 +228,7 @@ index 2404cb87..36cc389e 100644
struct path *pp;
int i;
- unsigned int dev_loss_tmo = mpp->dev_loss;
- struct path *err_path = NULL;
+ unsigned int min_dev_loss = 0;
+ bool warn_dev_loss = false;
+ bool warn_fast_io_fail = false;
@ -234,21 +242,24 @@ index 2404cb87..36cc389e 100644
- no_path_retry_tmo = MAX_DEV_LOSS_TMO;
- if (no_path_retry_tmo > dev_loss_tmo)
- dev_loss_tmo = no_path_retry_tmo;
- condlog(3, "%s: update dev_loss_tmo to %u",
- mpp->alias, dev_loss_tmo);
- } else if (mpp->no_path_retry == NO_PATH_RETRY_QUEUE) {
- dev_loss_tmo = MAX_DEV_LOSS_TMO;
- condlog(3, "%s: update dev_loss_tmo to %u",
- mpp->alias, dev_loss_tmo);
- }
- mpp->dev_loss = dev_loss_tmo;
- if (mpp->dev_loss && mpp->fast_io_fail > 0 &&
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET &&
- mpp->dev_loss != dev_loss_tmo) {
- condlog(2, "%s: Using dev_loss_tmo=%u instead of %u because of no_path_retry setting",
- mpp->alias, dev_loss_tmo, mpp->dev_loss);
- mpp->dev_loss = dev_loss_tmo;
- }
- if (mpp->dev_loss != DEV_LOSS_TMO_UNSET &&
- mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET &&
- (unsigned int)mpp->fast_io_fail >= mpp->dev_loss) {
- condlog(3, "%s: turning off fast_io_fail (%d is not smaller than dev_loss_tmo)",
- mpp->alias, mpp->fast_io_fail);
- mpp->fast_io_fail = MP_FAST_IO_FAIL_OFF;
- }
- if (!mpp->dev_loss && mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET &&
- if (mpp->dev_loss == DEV_LOSS_TMO_UNSET &&
- mpp->fast_io_fail == MP_FAST_IO_FAIL_UNSET &&
- mpp->eh_deadline == EH_DEADLINE_UNSET)
- return 0;
+ min_dev_loss = MAX_DEV_LOSS_TMO;
@ -258,58 +269,70 @@ index 2404cb87..36cc389e 100644
+ min_dev_loss = MAX_DEV_LOSS_TMO;
vector_foreach_slot(mpp->paths, pp, i) {
- if (pp->bus != SYSFS_BUS_SCSI) {
- if (!err_path)
- err_path = pp;
+ select_fast_io_fail(conf, pp);
+ select_dev_loss(conf, pp);
+ select_eh_deadline(conf, pp);
+
+ if (!pp->dev_loss && pp->eh_deadline == EH_DEADLINE_UNSET &&
+ pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
+ if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
+ pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET &&
+ pp->eh_deadline == EH_DEADLINE_UNSET)
+ continue;
+
+ if (pp->bus != SYSFS_BUS_SCSI)
+ continue;
+
if (pp->bus != SYSFS_BUS_SCSI)
continue;
+ sysfs_set_eh_deadline(pp);
+
+ if (!pp->dev_loss && pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
+ continue;
+ if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
+ pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
continue;
+
+ if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP &&
+ pp->sg_id.proto_id != SCSI_PROTOCOL_ISCSI &&
+ pp->sg_id.proto_id != SCSI_PROTOCOL_SAS)
+ continue;
+
+ if (pp->dev_loss > 0 && pp->dev_loss < min_dev_loss) {
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET &&
+ pp->dev_loss < min_dev_loss) {
+ warn_dev_loss = true;
+ pp->dev_loss = min_dev_loss;
+ }
+ if (pp->dev_loss > 0 && pp->fast_io_fail > 0 &&
+ if (pp->dev_loss != DEV_LOSS_TMO_UNSET &&
+ pp->fast_io_fail > 0 &&
+ (unsigned int)pp->fast_io_fail >= pp->dev_loss) {
+ warn_fast_io_fail = true;
+ pp->fast_io_fail = MP_FAST_IO_FAIL_OFF;
+ }
}
- if (mpp->dev_loss ||
- mpp->fast_io_fail != MP_FAST_IO_FAIL_UNSET) {
- if (pp->sg_id.proto_id == SCSI_PROTOCOL_FCP)
- sysfs_set_rport_tmo(mpp, pp);
- else if (pp->sg_id.proto_id == SCSI_PROTOCOL_ISCSI)
- sysfs_set_session_tmo(mpp, pp);
- else if (pp->sg_id.proto_id == SCSI_PROTOCOL_SAS)
- sysfs_set_nexus_loss_tmo(mpp, pp);
+ switch (pp->sg_id.proto_id) {
+ case SCSI_PROTOCOL_FCP:
+ sysfs_set_rport_tmo(mpp, pp);
+ break;
+ case SCSI_PROTOCOL_ISCSI:
switch (pp->sg_id.proto_id) {
@@ -883,25 +895,21 @@ sysfs_set_scsi_tmo (struct multipath *mpp, unsigned int checkint)
sysfs_set_rport_tmo(mpp, pp);
break;
case SCSI_PROTOCOL_ISCSI:
- sysfs_set_session_tmo(mpp, pp);
+ sysfs_set_session_tmo(pp);
+ break;
+ case SCSI_PROTOCOL_SAS:
break;
case SCSI_PROTOCOL_SAS:
- sysfs_set_nexus_loss_tmo(mpp, pp);
+ sysfs_set_nexus_loss_tmo(pp);
+ break;
+ default:
break;
default:
- if (!err_path)
- err_path = pp;
+ break;
}
- sysfs_set_eh_deadline(mpp, pp);
- }
-
- if (err_path) {
- STRBUF_ON_STACK(proto_buf);
-
- snprint_path_protocol(&proto_buf, err_path);
- condlog(2, "%s: setting dev_loss_tmo is unsupported for protocol %s",
- mpp->alias, get_strbuf_str(&proto_buf));
}
+ if (warn_dev_loss)
+ condlog(2, "%s: Raising dev_loss_tmo to %u because of no_path_retry setting",
@ -334,10 +357,10 @@ index a5446b4d..b6eea258 100644
int sysfs_get_host_pci_name(const struct path *pp, char *pci_name);
int sysfs_get_iscsi_ip_address(const struct path *pp, char *ip_address);
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 127b3370..25326eb6 100644
index 677ab9e1..f146fe64 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -766,51 +766,51 @@ int select_minio(struct config *conf, struct multipath *mp)
@@ -770,53 +770,53 @@ int select_minio(struct config *conf, struct multipath *mp)
return select_minio_bio(conf, mp);
}
@ -345,7 +368,7 @@ index 127b3370..25326eb6 100644
+int select_fast_io_fail(struct config *conf, struct path *pp)
{
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- mp_set_ovr(fast_io_fail);
- mp_set_hwe(fast_io_fail);
@ -356,10 +379,11 @@ index 127b3370..25326eb6 100644
+ pp_set_conf(fast_io_fail);
+ pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL);
out:
- print_undef_off_zero(buff, 12, mp->fast_io_fail);
- condlog(3, "%s: fast_io_fail_tmo = %s %s", mp->alias, buff, origin);
+ print_undef_off_zero(buff, 12, pp->fast_io_fail);
+ condlog(3, "%s: fast_io_fail_tmo = %s %s", pp->dev, buff, origin);
- print_undef_off_zero(&buff, mp->fast_io_fail);
- condlog(3, "%s: fast_io_fail_tmo = %s %s", mp->alias,
+ print_undef_off_zero(&buff, pp->fast_io_fail);
+ condlog(3, "%s: fast_io_fail_tmo = %s %s", pp->dev,
get_strbuf_str(&buff), origin);
return 0;
}
@ -367,22 +391,23 @@ index 127b3370..25326eb6 100644
+int select_dev_loss(struct config *conf, struct path *pp)
{
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- mp_set_ovr(dev_loss);
- mp_set_hwe(dev_loss);
- mp_set_conf(dev_loss);
- mp->dev_loss = 0;
- mp->dev_loss = DEV_LOSS_TMO_UNSET;
+ pp_set_ovr(dev_loss);
+ pp_set_hwe(dev_loss);
+ pp_set_conf(dev_loss);
+ pp->dev_loss = 0;
+ pp->dev_loss = DEV_LOSS_TMO_UNSET;
return 0;
out:
- print_dev_loss(buff, 12, mp->dev_loss);
- condlog(3, "%s: dev_loss_tmo = %s %s", mp->alias, buff, origin);
+ print_dev_loss(buff, 12, pp->dev_loss);
+ condlog(3, "%s: dev_loss_tmo = %s %s", pp->dev, buff, origin);
- print_dev_loss(&buff, mp->dev_loss);
- condlog(3, "%s: dev_loss_tmo = %s %s", mp->alias,
+ print_dev_loss(&buff, pp->dev_loss);
+ condlog(3, "%s: dev_loss_tmo = %s %s", pp->dev,
get_strbuf_str(&buff), origin);
return 0;
}
@ -390,7 +415,7 @@ index 127b3370..25326eb6 100644
+int select_eh_deadline(struct config *conf, struct path *pp)
{
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- mp_set_ovr(eh_deadline);
- mp_set_hwe(eh_deadline);
@ -403,13 +428,13 @@ index 127b3370..25326eb6 100644
/* not changing sysfs in default cause, so don't print anything */
return 0;
out:
- print_undef_off_zero(buff, 12, mp->eh_deadline);
- condlog(3, "%s: eh_deadline = %s %s", mp->alias, buff, origin);
+ print_undef_off_zero(buff, 12, pp->eh_deadline);
+ condlog(3, "%s: eh_deadline = %s %s", pp->dev, buff, origin);
- print_undef_off_zero(&buff, mp->eh_deadline);
- condlog(3, "%s: eh_deadline = %s %s", mp->alias,
+ print_undef_off_zero(&buff, pp->eh_deadline);
+ condlog(3, "%s: eh_deadline = %s %s", pp->dev,
get_strbuf_str(&buff), origin);
return 0;
}
diff --git a/libmultipath/propsel.h b/libmultipath/propsel.h
index 72a7e33c..152ca44c 100644
--- a/libmultipath/propsel.h
@ -428,10 +453,10 @@ index 72a7e33c..152ca44c 100644
int select_retain_hwhandler (struct config *conf, struct multipath * mp);
int select_detect_prio(struct config *conf, struct path * pp);
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 19099bed..9f86eb69 100644
index d20e1eea..acd4cbeb 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -230,7 +230,6 @@ alloc_multipath (void)
@@ -246,7 +246,6 @@ alloc_multipath (void)
mpp->bestpg = 1;
mpp->mpcontext = NULL;
mpp->no_path_retry = NO_PATH_RETRY_UNDEF;
@ -440,10 +465,10 @@ index 19099bed..9f86eb69 100644
}
return mpp;
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index ab99852f..875e726e 100644
index 618ff4fb..8a07d470 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -344,6 +344,9 @@ struct path {
@@ -340,6 +340,9 @@ struct path {
int marginal;
int vpd_vendor_id;
int recheck_wwid;
@ -453,7 +478,7 @@ index ab99852f..875e726e 100644
/* configlet pointers */
vector hwe;
struct gen_path generic_path;
@@ -371,7 +374,6 @@ struct multipath {
@@ -367,7 +370,6 @@ struct multipath {
int minio;
int flush_on_last_del;
int attribute_flags;
@ -461,7 +486,7 @@ index ab99852f..875e726e 100644
int retain_hwhandler;
int deferred_remove;
bool in_recovery;
@@ -389,8 +391,6 @@ struct multipath {
@@ -385,8 +387,6 @@ struct multipath {
int needs_paths_uevent;
int ghost_delay;
int ghost_delay_tick;

View File

@ -15,10 +15,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 25326eb6..209c1d67 100644
index f146fe64..2b47f5f8 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -79,6 +79,8 @@ static const char conf_origin[] =
@@ -80,6 +80,8 @@ static const char conf_origin[] =
"(setting: multipath.conf defaults/devices section)";
static const char overrides_origin[] =
"(setting: multipath.conf overrides section)";
@ -27,7 +27,7 @@ index 25326eb6..209c1d67 100644
static const char cmdline_origin[] =
"(setting: multipath command line [-p] flag)";
static const char autodetect_origin[] =
@@ -144,6 +146,27 @@ do { \
@@ -147,6 +149,27 @@ do { \
} \
} while (0)
@ -55,27 +55,27 @@ index 25326eb6..209c1d67 100644
int select_mode(struct config *conf, struct multipath *mp)
{
const char *origin;
@@ -771,7 +794,7 @@ int select_fast_io_fail(struct config *conf, struct path *pp)
@@ -775,7 +798,7 @@ int select_fast_io_fail(struct config *conf, struct path *pp)
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- pp_set_ovr(fast_io_fail);
+ pp_set_ovr_pce(fast_io_fail);
pp_set_hwe(fast_io_fail);
pp_set_conf(fast_io_fail);
pp_set_default(fast_io_fail, DEFAULT_FAST_IO_FAIL);
@@ -786,7 +809,7 @@ int select_dev_loss(struct config *conf, struct path *pp)
@@ -791,7 +814,7 @@ int select_dev_loss(struct config *conf, struct path *pp)
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- pp_set_ovr(dev_loss);
+ pp_set_ovr_pce(dev_loss);
pp_set_hwe(dev_loss);
pp_set_conf(dev_loss);
pp->dev_loss = 0;
@@ -802,7 +825,7 @@ int select_eh_deadline(struct config *conf, struct path *pp)
pp->dev_loss = DEV_LOSS_TMO_UNSET;
@@ -808,7 +831,7 @@ int select_eh_deadline(struct config *conf, struct path *pp)
const char *origin;
char buff[12];
STRBUF_ON_STACK(buff);
- pp_set_ovr(eh_deadline);
+ pp_set_ovr_pce(eh_deadline);

View File

@ -10,10 +10,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 4 insertions(+)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 0c04c7e4..b14fd215 100644
index 58ad5c9c..47404545 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1602,6 +1602,8 @@ section:
@@ -1637,6 +1637,8 @@ section:
.TP
.B dev_loss_tmo
.TP
@ -22,7 +22,7 @@ index 0c04c7e4..b14fd215 100644
.B flush_on_last_del
.TP
.B user_friendly_names
@@ -1688,6 +1690,8 @@ the values are taken from the \fIdevices\fR or \fIdefaults\fR sections:
@@ -1723,6 +1725,8 @@ the values are taken from the \fIdevices\fR or \fIdefaults\fR sections:
.TP
.B dev_loss_tmo
.TP

View File

@ -10,10 +10,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 32 insertions(+)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index b14fd215..abbc89af 100644
index 47404545..f7de5140 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1730,6 +1730,38 @@ the values are taken from the \fIdevices\fR or \fIdefaults\fR sections:
@@ -1765,6 +1765,38 @@ the values are taken from the \fIdevices\fR or \fIdefaults\fR sections:
.RE
.PD
.LP

View File

@ -12,10 +12,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 88975323..bcd8b541 100644
index 8b0e1f72..61b0dd51 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -319,7 +319,7 @@ alloc_pce (void)
@@ -384,7 +384,7 @@ alloc_pce (void)
{
struct pcentry *pce = (struct pcentry *)
calloc(1, sizeof(struct pcentry));
@ -24,7 +24,7 @@ index 88975323..bcd8b541 100644
return pce;
}
@@ -578,7 +578,7 @@ validate_pctable(struct hwentry *ovr, int idx, const char *table_desc)
@@ -643,7 +643,7 @@ validate_pctable(struct hwentry *ovr, int idx, const char *table_desc)
return;
vector_foreach_slot_after(ovr->pctable, pce, idx) {
@ -34,7 +34,7 @@ index 88975323..bcd8b541 100644
table_desc);
vector_del_slot(ovr->pctable, idx--);
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 143116b3..477f8bfa 100644
index 57992604..c1e18363 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -41,6 +41,7 @@ enum force_reload_types {

View File

@ -12,7 +12,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 59bc0d6e..d6325864 100644
index a8ba28e3..d7c487b1 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -182,8 +182,8 @@ static struct hwentry default_hw[] = {

View File

@ -17,7 +17,7 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 1 insertion(+)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index d6325864..2bb274c5 100644
index d7c487b1..22ff1881 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -343,6 +343,7 @@ static struct hwentry default_hw[] = {

View File

@ -21,13 +21,13 @@ Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
Makefile.inc | 5 +++++
multipathd/Makefile | 11 ++++++++++-
multipathd/Makefile | 12 +++++++++++-
multipathd/cli.c | 5 +++++
multipathd/uxclnt.c | 6 ++++++
4 files changed, 26 insertions(+), 1 deletion(-)
4 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index 25c16f4e..d471f045 100644
index 688c4599..05027703 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -14,6 +14,11 @@
@ -40,13 +40,13 @@ index 25c16f4e..d471f045 100644
+# see https://github.com/opensvc/multipath-tools/issues/36
+READLINE = libedit
ifeq ($(TOPDIR),)
TOPDIR = ..
PKGCONFIG ?= pkg-config
diff --git a/multipathd/Makefile b/multipathd/Makefile
index 835edd93..4874ec3a 100644
index cd6f7e6d..00342464 100644
--- a/multipathd/Makefile
+++ b/multipathd/Makefile
@@ -15,7 +15,16 @@ CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) \
@@ -19,7 +19,17 @@ CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathpersistdir) \
LDFLAGS += $(BIN_LDFLAGS)
LIBDEPS += -L$(multipathdir) -lmultipath -L$(mpathpersistdir) -lmpathpersist \
-L$(mpathcmddir) -lmpathcmd -ludev -ldl -lurcu -lpthread \
@ -61,11 +61,12 @@ index 835edd93..4874ec3a 100644
+CFLAGS += -DUSE_LIBREADLINE
+LIBDEPS += -lreadline
+endif
+
CFLAGS += $(shell $(PKGCONFIG) --modversion liburcu 2>/dev/null | \
awk -F. '{ printf("-DURCU_VERSION=0x%06x", 256 * ( 256 * $$1 + $$2) + $$3); }')
ifdef SYSTEMD
CFLAGS += -DUSE_SYSTEMD=$(SYSTEMD)
diff --git a/multipathd/cli.c b/multipathd/cli.c
index bdc9fb10..85d73dfb 100644
index 4d6c37c9..cc547e67 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -11,7 +11,12 @@

View File

@ -14,10 +14,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 29 insertions(+), 27 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index a6ffbe32..9b1098f6 100644
index ed2515e5..b00eae3f 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -487,6 +487,30 @@ int update_multipath (struct vectors *vecs, char *mapname, int reset)
@@ -488,6 +488,30 @@ int update_multipath (struct vectors *vecs, char *mapname, int reset)
return 0;
}
@ -48,7 +48,7 @@ index a6ffbe32..9b1098f6 100644
static int
update_map (struct multipath *mpp, struct vectors *vecs, int new_map)
{
@@ -1185,34 +1209,12 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
@@ -1247,34 +1271,12 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
vector_del_slot(mpp->paths, i);
/*
@ -75,7 +75,7 @@ index a6ffbe32..9b1098f6 100644
- condlog(2, "%s: removed map after"
- " removing all paths",
- alias);
- retval = 0;
- /* flush_map() has freed the path */
- goto out;
- }
- /*
@ -86,5 +86,5 @@ index a6ffbe32..9b1098f6 100644
+ flush_map_nopaths(mpp, vecs))
+ goto out;
if (mpp->hwe == NULL)
extract_hwe_from_path(mpp);
if (setup_map(mpp, &params, vecs)) {
condlog(0, "%s: failed to setup map for"

View File

@ -16,10 +16,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index e3c3c119..ee81acc3 100644
index 1ff75c81..4b2e8a15 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -916,6 +916,10 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
@@ -1104,6 +1104,10 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove,
}
condlog(4, "multipath map %s removed", mapname);
return 0;
@ -31,10 +31,10 @@ index e3c3c119..ee81acc3 100644
condlog(2, "failed to remove multipath map %s",
mapname);
diff --git a/multipathd/main.c b/multipathd/main.c
index 9b1098f6..9eafd5b7 100644
index b00eae3f..68ee067b 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -673,10 +673,6 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
@@ -685,10 +685,6 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths)
* the spurious uevent we may generate with the dm_flush_map call below
*/
if (r) {

View File

@ -20,17 +20,17 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 4 insertions(+)
diff --git a/multipathd/main.c b/multipathd/main.c
index 9eafd5b7..870ae7d8 100644
index 68ee067b..d2c48d3b 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -526,6 +526,10 @@ retry:
@@ -529,6 +529,10 @@ retry:
goto fail;
}
verify_paths(mpp, vecs);
verify_paths(mpp);
+ if (VECTOR_SIZE(mpp->paths) == 0 &&
+ flush_map_nopaths(mpp, vecs))
+ return 1;
+
mpp->action = ACT_RELOAD;
if (setup_map(mpp, params, PARAMS_SIZE, vecs)) {
if (mpp->prflag) {

View File

@ -13,10 +13,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
2 files changed, 58 insertions(+), 56 deletions(-)
diff --git a/multipathd/cli.c b/multipathd/cli.c
index 85d73dfb..45e80197 100644
index cc547e67..eb2e8c1d 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -341,9 +341,11 @@ fingerprint(vector vec)
@@ -342,9 +342,11 @@ fingerprint(vector vec)
if (!vec)
return 0;
@ -32,10 +32,10 @@ index 85d73dfb..45e80197 100644
}
diff --git a/multipathd/main.c b/multipathd/main.c
index 870ae7d8..cd68a9d2 100644
index d2c48d3b..a098f3c2 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1628,62 +1628,62 @@ uxlsnrloop (void * ap)
@@ -1696,62 +1696,62 @@ uxlsnrloop (void * ap)
/* Tell main thread that thread has started */
post_config_state(DAEMON_CONFIGURE);

View File

@ -24,11 +24,11 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
create mode 100644 multipath/tmpfiles.conf.in
diff --git a/.gitignore b/.gitignore
index 9926756b..f90b0350 100644
index 087dffc2..6ee4fa09 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,8 @@
*.d
@@ -11,6 +11,8 @@ cscope.files
cscope.out
kpartx/kpartx
multipath/multipath
+multipath/multipath.rules
@ -37,10 +37,10 @@ index 9926756b..f90b0350 100644
mpathpersist/mpathpersist
.nfs*
diff --git a/Makefile.inc b/Makefile.inc
index d471f045..287f0e7b 100644
index 05027703..4c452159 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -60,6 +60,7 @@ exec_prefix = $(prefix)
@@ -62,6 +62,7 @@ exec_prefix = $(prefix)
usr_prefix = $(prefix)
bindir = $(exec_prefix)/usr/sbin
libudevdir = $(prefix)/$(SYSTEMDPATH)/udev
@ -48,7 +48,7 @@ index d471f045..287f0e7b 100644
udevrulesdir = $(libudevdir)/rules.d
multipathdir = $(TOPDIR)/libmultipath
man8dir = $(prefix)/usr/share/man/man8
@@ -76,6 +77,7 @@ libdmmpdir = $(TOPDIR)/libdmmp
@@ -79,6 +80,7 @@ libdmmpdir = $(TOPDIR)/libdmmp
nvmedir = $(TOPDIR)/libmultipath/nvme
includedir = $(prefix)/usr/include
pkgconfdir = $(usrlibdir)/pkgconfig
@ -56,20 +56,20 @@ index d471f045..287f0e7b 100644
GZIP = gzip -9 -c
RM = rm -f
@@ -117,7 +119,7 @@ OPTFLAGS += -Werror -Wextra -Wstrict-prototypes -Wformat=2 \
-Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
--param=ssp-buffer-size=4
-CFLAGS := $(OPTFLAGS) -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
+CFLAGS := $(OPTFLAGS) -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" -DRUNTIME_DIR=\"$(runtimedir)\" \
-MMD -MP $(CFLAGS)
@@ -120,7 +122,7 @@ WARNFLAGS := -Werror -Wextra -Wformat=2 $(WFORMATOVERFLOW) -Werror=implicit-int
$(WNOCLOBBERED) -Werror=cast-qual $(ERROR_DISCARDED_QUALIFIERS) \
-Wstrict-prototypes
CFLAGS := --std=gnu99 $(CFLAGS) $(OPTFLAGS) $(WARNFLAGS) -pipe \
- -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" \
+ -DBIN_DIR=\"$(bindir)\" -DLIB_STRING=\"${LIB}\" -DRUN_DIR=\"${RUN}\" -DRUNTIME_DIR=\"$(runtimedir)\" \
-MMD -MP
BIN_CFLAGS = -fPIE -DPIE
LIB_CFLAGS = -fPIC
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index f1cb000d..dcd9f5a7 100644
index e0dd32ad..cec82f07 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -65,7 +65,7 @@
@@ -69,7 +69,7 @@
#define DEFAULT_WWIDS_FILE "/etc/multipath/wwids"
#define DEFAULT_PRKEYS_FILE "/etc/multipath/prkeys"
#define DEFAULT_CONFIG_DIR "/etc/multipath/conf.d"

View File

@ -16,10 +16,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/kpartx/kpartx.c b/kpartx/kpartx.c
index a337a07b..e62b764f 100644
index 7bc64543..e79fdd4a 100644
--- a/kpartx/kpartx.c
+++ b/kpartx/kpartx.c
@@ -426,12 +426,7 @@ main(int argc, char **argv){
@@ -443,12 +443,7 @@ main(int argc, char **argv){
if (n >= 0)
printf("%s: %d slices\n", ptp->type, n);
#endif
@ -33,7 +33,7 @@ index a337a07b..e62b764f 100644
continue;
switch(what) {
@@ -649,9 +644,9 @@ main(int argc, char **argv){
@@ -668,9 +663,9 @@ main(int argc, char **argv){
if (n > 0)
break;
}

View File

@ -17,7 +17,7 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 29 insertions(+), 53 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 9f86eb69..471087e2 100644
index acd4cbeb..83906ffe 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -6,6 +6,7 @@
@ -28,7 +28,7 @@ index 9f86eb69..471087e2 100644
#include "checkers.h"
#include "memory.h"
@@ -633,7 +634,7 @@ int add_feature(char **f, const char *n)
@@ -669,7 +670,7 @@ int add_feature(char **f, const char *n)
int remove_feature(char **f, const char *o)
{
@ -37,7 +37,7 @@ index 9f86eb69..471087e2 100644
char *e, *p, *n;
const char *q;
@@ -644,33 +645,35 @@ int remove_feature(char **f, const char *o)
@@ -680,33 +681,35 @@ int remove_feature(char **f, const char *o)
if (!o || *o == '\0')
return 0;
@ -90,7 +90,7 @@ index 9f86eb69..471087e2 100644
c--;
q++;
}
@@ -684,15 +687,8 @@ int remove_feature(char **f, const char *o)
@@ -720,15 +723,8 @@ int remove_feature(char **f, const char *o)
goto out;
}
@ -107,7 +107,7 @@ index 9f86eb69..471087e2 100644
if (!n)
return 1;
@@ -702,36 +698,16 @@ int remove_feature(char **f, const char *o)
@@ -738,36 +734,16 @@ int remove_feature(char **f, const char *o)
* Copy existing features up to the feature
* about to be removed
*/

View File

@ -18,10 +18,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 24 insertions(+), 25 deletions(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 471087e2..84f9c959 100644
index 83906ffe..5dfa86a8 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -572,23 +572,33 @@ int add_feature(char **f, const char *n)
@@ -608,23 +608,33 @@ int add_feature(char **f, const char *n)
{
int c = 0, d, l;
char *e, *t;
@ -59,7 +59,7 @@ index 471087e2..84f9c959 100644
if(l == -1)
return 1;
@@ -597,35 +607,24 @@ int add_feature(char **f, const char *n)
@@ -633,35 +643,24 @@ int add_feature(char **f, const char *n)
}
/* Check if feature is already present */

View File

@ -7,29 +7,29 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
tests/Makefile | 2 +-
tests/features.c | 318 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 319 insertions(+), 1 deletion(-)
tests/features.c | 319 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 320 insertions(+), 1 deletion(-)
create mode 100644 tests/features.c
diff --git a/tests/Makefile b/tests/Makefile
index 77ff3249..914413b8 100644
index 8cbc4b73..972a5e04 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -13,7 +13,7 @@ CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir) \
LIBDEPS += -L$(multipathdir) -lmultipath -lcmocka
LIBDEPS += -L. -L$(mpathcmddir) -lmultipath -lmpathcmd -lcmocka
TESTS := uevent parser util dmevents hwtable blacklist unaligned vpd pgpolicy \
- alias directio
+ alias directio features
- alias directio valid devt mpathvalid strbuf
+ alias directio valid devt mpathvalid strbuf features
HELPERS := test-lib.o test-log.o
.SILENT: $(TESTS:%=%.o)
.PRECIOUS: $(TESTS:%=%-test)
diff --git a/tests/features.c b/tests/features.c
new file mode 100644
index 00000000..1e2e6bff
index 00000000..4d8f0860
--- /dev/null
+++ b/tests/features.c
@@ -0,0 +1,318 @@
@@ -0,0 +1,319 @@
+#include <stddef.h>
+#include <stdarg.h>
+#include <setjmp.h>
@ -343,6 +343,7 @@ index 00000000..1e2e6bff
+{
+ int ret = 0;
+
+ init_test_verbosity(-1);
+ ret += test_add_features();
+ ret += test_remove_features();
+

View File

@ -14,38 +14,36 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
libmultipath/dmparser.c | 2 ++
libmultipath/propsel.c | 55 ++++++++++++++++++++++++++++++++++++++
libmultipath/structs.h | 7 +++++
libmultipath/util.c | 10 +++++++
libmultipath/util.h | 1 +
multipath/multipath.conf.5 | 7 +++--
7 files changed, 84 insertions(+), 2 deletions(-)
5 files changed, 73 insertions(+), 2 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 6cad0468..287289f7 100644
index 70049f47..cc778a22 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1102,6 +1102,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
uint64_t *size_mismatch_seen;
bool map_processed = false;
bool no_daemon = false;
@@ -1118,6 +1118,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
struct config *conf = NULL;
int allow_queueing;
struct bitfield *size_mismatch_seen;
+ struct multipath * cmpp;
/* ignore refwwid if it's empty */
if (refwwid && !strlen(refwwid))
@@ -1197,6 +1198,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
@@ -1227,6 +1228,9 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
}
verify_paths(mpp, vecs);
verify_paths(mpp);
+ cmpp = find_mp_by_wwid(curmp, mpp->wwid);
+ if (cmpp)
+ mpp->queue_mode = cmpp->queue_mode;
params[0] = '\0';
if (setup_map(mpp, params, PARAMS_SIZE, vecs)) {
remove_map(mpp, vecs, 0);
if (setup_map(mpp, &params, vecs)) {
remove_map(mpp, vecs->pathvec, NULL);
continue;
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index b856a07f..b9c4dabc 100644
index bc311421..16377c54 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -164,6 +164,8 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
@@ -152,6 +152,8 @@ int disassemble_map(const struct _vector *pathvec,
FREE(word);
}
@ -55,18 +53,18 @@ index b856a07f..b9c4dabc 100644
/*
* hwhandler
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index be79902f..3f119dd9 100644
index 2b47f5f8..9dea6f92 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -26,6 +26,7 @@
#include "propsel.h"
@@ -27,6 +27,7 @@
#include "strbuf.h"
#include <inttypes.h>
#include <libudev.h>
+#include <ctype.h>
pgpolicyfn *pgpolicies[] = {
NULL,
@@ -413,6 +414,59 @@ void reconcile_features_with_options(const char *id, char **features, int* no_pa
@@ -414,6 +415,59 @@ void reconcile_features_with_options(const char *id, char **features, int* no_pa
}
}
@ -126,7 +124,7 @@ index be79902f..3f119dd9 100644
int select_features(struct config *conf, struct multipath *mp)
{
const char *origin;
@@ -428,6 +482,7 @@ out:
@@ -429,6 +483,7 @@ out:
reconcile_features_with_options(mp->alias, &mp->features,
&mp->no_path_retry,
&mp->retain_hwhandler);
@ -135,10 +133,10 @@ index be79902f..3f119dd9 100644
return 0;
}
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 3ed5cfc1..9a404da7 100644
index 8a07d470..b4f75de0 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -187,6 +187,12 @@ enum max_sectors_kb_states {
@@ -170,6 +170,12 @@ enum max_sectors_kb_states {
MAX_SECTORS_KB_MIN = 4, /* can't be smaller than page size */
};
@ -151,7 +149,7 @@ index 3ed5cfc1..9a404da7 100644
enum scsi_protocol {
SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */
SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */
@@ -397,6 +403,7 @@ struct multipath {
@@ -387,6 +393,7 @@ struct multipath {
int needs_paths_uevent;
int ghost_delay;
int ghost_delay_tick;
@ -159,44 +157,11 @@ index 3ed5cfc1..9a404da7 100644
uid_t uid;
gid_t gid;
mode_t mode;
diff --git a/libmultipath/util.c b/libmultipath/util.c
index dd30a46e..e04d20ab 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -465,6 +465,16 @@ void free_scandir_result(struct scandir_result *res)
FREE(res->di);
}
+void cleanup_free_ptr(void *arg)
+{
+ void **p = arg;
+
+ if (p && *p) {
+ free(*p);
+ *p = NULL;
+ }
+}
+
void close_fd(void *arg)
{
close((long)arg);
diff --git a/libmultipath/util.h b/libmultipath/util.h
index ce277680..f898c829 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -44,6 +44,7 @@ void set_max_fds(rlim_t max_fds);
pthread_cleanup_push(((void (*)(void *))&f), (arg))
void close_fd(void *arg);
+void cleanup_free_ptr(void *arg);
void cleanup_mutex(void *arg);
struct scandir_result {
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 8e418372..61d2712b 100644
index f7de5140..e1a787d4 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -458,8 +458,11 @@ precedence. See KNOWN ISSUES.
@@ -468,8 +468,11 @@ precedence. See KNOWN ISSUES.
<mode> can be \fIbio\fR, \fIrq\fR or \fImq\fR, which corresponds to
bio-based, request-based, and block-multiqueue (blk-mq) request-based,
respectively.

View File

@ -11,27 +11,27 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
2 files changed, 233 insertions(+), 1 deletion(-)
diff --git a/tests/Makefile b/tests/Makefile
index 914413b8..f3e49487 100644
index 972a5e04..27e3ffa9 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -29,6 +29,7 @@ endif
ifneq ($(DIO_TEST_DEV),)
@@ -33,6 +33,7 @@ ifneq ($(DIO_TEST_DEV),)
directio-test_FLAGS := -DDIO_TEST_DEV=\"$(DIO_TEST_DEV)\"
endif
mpathvalid-test_FLAGS := -I$(mpathvaliddir)
+features-test_FLAGS := -I$(multipathdir)/nvme
# test-specific linker flags
# XYZ-test_TESTDEPS: test libraries containing __wrap_xyz functions
@@ -53,6 +54,7 @@ alias-test_LIBDEPS := -lpthread -ldl
ifneq ($(DIO_TEST_DEV),)
@@ -64,6 +65,7 @@ ifneq ($(DIO_TEST_DEV),)
directio-test_LIBDEPS := -laio
endif
strbuf-test_OBJDEPS := ../libmultipath/strbuf.o
+features-test_LIBDEPS := -ludev -lpthread
%.o: %.c
$(CC) $(CFLAGS) $($*-test_FLAGS) -c -o $@ $<
diff --git a/tests/features.c b/tests/features.c
index 1e2e6bff..01fbccb7 100644
index 4d8f0860..31f978fd 100644
--- a/tests/features.c
+++ b/tests/features.c
@@ -1,9 +1,10 @@
@ -46,7 +46,7 @@ index 1e2e6bff..01fbccb7 100644
#include "globals.c"
static void test_af_null_features_ptr(void **state)
@@ -307,12 +308,241 @@ static int test_remove_features(void)
@@ -307,6 +308,234 @@ static int test_remove_features(void)
return cmocka_run_group_tests(tests, NULL, NULL);
}
@ -281,7 +281,8 @@ index 1e2e6bff..01fbccb7 100644
int main(void)
{
int ret = 0;
@@ -314,6 +543,7 @@ int main(void)
init_test_verbosity(-1);
ret += test_add_features();
ret += test_remove_features();
+ ret += test_reconcile_features();

View File

@ -18,7 +18,7 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
6 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 287289f7..8e1bc488 100644
index cc778a22..c6803b40 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -223,10 +223,11 @@ int rr_optimize_path_order(struct pathgroup *pgp)
@ -38,10 +38,10 @@ index 287289f7..8e1bc488 100644
* is maintained in path group
*/
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 36cc389e..5f4e0794 100644
index bcda8b09..7f2eb409 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -468,10 +468,11 @@ int sysfs_get_host_adapter_name(const struct path *pp, char *adapter_name)
@@ -481,10 +481,11 @@ int sysfs_get_host_adapter_name(const struct path *pp, char *adapter_name)
proto_id = pp->sg_id.proto_id;
@ -57,7 +57,7 @@ index 36cc389e..5f4e0794 100644
return 1;
}
/* iscsi doesn't have adapter info in sysfs
@@ -1722,8 +1723,10 @@ sysfs_pathinfo(struct path * pp, vector hwtable)
@@ -1754,8 +1755,10 @@ sysfs_pathinfo(struct path *pp, const struct _vector *hwtable)
pp->bus = SYSFS_BUS_CCISS;
if (!strncmp(pp->dev,"dasd", 4))
pp->bus = SYSFS_BUS_CCW;
@ -70,47 +70,47 @@ index 36cc389e..5f4e0794 100644
pp->bus = SYSFS_BUS_NVME;
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 8a6fbe83..8a85df66 100644
index 46e3d32e..082e4e30 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -558,7 +558,8 @@ snprint_host_attr (char * buff, size_t len, const struct path * pp, char *attr)
@@ -592,7 +592,8 @@ snprint_host_attr (struct strbuf *buff, const struct path * pp, char *attr)
const char *value = NULL;
int ret;
- if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP)
+ if (pp->bus != SYSFS_BUS_SCSI ||
+ pp->sg_id.proto_id != SCSI_PROTOCOL_FCP)
return snprintf(buff, len, "[undef]");
return append_strbuf_str(buff, "[undef]");
sprintf(host_id, "host%d", pp->sg_id.host_no);
host_dev = udev_device_new_from_subsystem_sysname(udev, "fc_host",
@@ -597,7 +598,8 @@ snprint_tgt_wwpn (char * buff, size_t len, const struct path * pp)
@@ -631,7 +632,8 @@ snprint_tgt_wwpn (struct strbuf *buff, const struct path * pp)
const char *value = NULL;
int ret;
- if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP)
+ if (pp->bus != SYSFS_BUS_SCSI ||
+ pp->sg_id.proto_id != SCSI_PROTOCOL_FCP)
return snprintf(buff, len, "[undef]");
return append_strbuf_str(buff, "[undef]");
sprintf(rport_id, "rport-%d:%d-%d",
pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 84f9c959..1122cfae 100644
index 5dfa86a8..be81a83c 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -115,7 +115,7 @@ alloc_path (void)
@@ -116,7 +116,7 @@ alloc_path (void)
pp->sg_id.channel = -1;
pp->sg_id.scsi_id = -1;
pp->sg_id.lun = -1;
pp->sg_id.lun = SCSI_INVALID_LUN;
- pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC;
+ pp->sg_id.proto_id = PROTOCOL_UNSET;
pp->fd = -1;
pp->tpgs = TPGS_UNDEF;
pp->priority = PRIO_UNDEF;
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 9a404da7..960ea024 100644
index b4f75de0..2525af17 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -193,6 +193,8 @@ enum queue_mode_states {
@@ -176,6 +176,8 @@ enum queue_mode_states {
QUEUE_MODE_RQ,
};
@ -119,8 +119,8 @@ index 9a404da7..960ea024 100644
enum scsi_protocol {
SCSI_PROTOCOL_FCP = 0, /* Fibre Channel */
SCSI_PROTOCOL_SPI = 1, /* parallel SCSI */
@@ -294,7 +296,7 @@ struct sg_id {
int lun;
@@ -284,7 +286,7 @@ struct sg_id {
uint64_t lun;
short h_cmd_per_lun;
short d_queue_depth;
- enum scsi_protocol proto_id;
@ -129,10 +129,10 @@ index 9a404da7..960ea024 100644
};
diff --git a/multipathd/fpin_handlers.c b/multipathd/fpin_handlers.c
index b14366d7..599f2893 100644
index aaf5655d..571796e7 100644
--- a/multipathd/fpin_handlers.c
+++ b/multipathd/fpin_handlers.c
@@ -220,7 +220,7 @@ static int fpin_chk_wwn_setpath_marginal(uint16_t host_num, struct vectors *ve
@@ -219,7 +219,7 @@ static int fpin_chk_wwn_setpath_marginal(uint16_t host_num, struct vectors *ve
vector_foreach_slot(vecs->pathvec, pp, k) {
/* Checks the host number and also for the SCSI FCP */

View File

@ -17,18 +17,18 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
4 files changed, 61 insertions(+), 22 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 5f4e0794..eb7a634b 100644
index 7f2eb409..f593a7bf 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1455,6 +1455,7 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable)
@@ -1483,6 +1483,7 @@ nvme_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable)
struct udev_device *parent;
const char *attr_path = NULL;
const char *attr;
+ int i;
attr_path = udev_device_get_sysname(pp->udev);
if (!attr_path)
@@ -1476,6 +1477,18 @@ nvme_sysfs_pathinfo (struct path * pp, vector hwtable)
if (pp->udev)
attr_path = udev_device_get_sysname(pp->udev);
@@ -1505,6 +1506,18 @@ nvme_sysfs_pathinfo (struct path *pp, const struct _vector *hwtable)
attr = udev_device_get_sysattr_value(parent, "cntlid");
pp->sg_id.channel = attr ? atoi(attr) : 0;
@ -47,7 +47,7 @@ index 5f4e0794..eb7a634b 100644
snprintf(pp->vendor_id, SCSI_VENDOR_SIZE, "NVME");
snprintf(pp->product_id, PATH_PRODUCT_SIZE, "%s",
udev_device_get_sysattr_value(parent, "model"));
@@ -1727,9 +1740,10 @@ sysfs_pathinfo(struct path * pp, vector hwtable)
@@ -1759,9 +1772,10 @@ sysfs_pathinfo(struct path *pp, const struct _vector *hwtable)
pp->bus = SYSFS_BUS_SCSI;
pp->sg_id.proto_id = SCSI_PROTOCOL_UNSPEC;
}
@ -61,7 +61,7 @@ index 5f4e0794..eb7a634b 100644
case SYSFS_BUS_SCSI:
return scsi_sysfs_pathinfo(pp, hwtable);
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 1122cfae..7bdf9152 100644
index be81a83c..a2e56890 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -25,7 +25,6 @@ const char * const protocol_name[LAST_BUS_PROTOCOL_ID + 1] = {
@ -86,7 +86,7 @@ index 1122cfae..7bdf9152 100644
};
struct adapter_group *
@@ -716,11 +722,17 @@ out:
@@ -752,11 +758,17 @@ out:
}
unsigned int bus_protocol_id(const struct path *pp) {
@ -109,10 +109,10 @@ index 1122cfae..7bdf9152 100644
+ return pp->bus + pp->sg_id.proto_id;
}
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 960ea024..9130efb5 100644
index 2525af17..0867b91d 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -57,15 +57,6 @@ enum failback_mode {
@@ -56,15 +56,6 @@ enum failback_mode {
FAILBACK_FOLLOWOVER
};
@ -128,7 +128,7 @@ index 960ea024..9130efb5 100644
enum pathstates {
PSTATE_UNDEF,
PSTATE_FAILED,
@@ -207,14 +198,32 @@ enum scsi_protocol {
@@ -190,14 +181,32 @@ enum scsi_protocol {
SCSI_PROTOCOL_ATA = 8,
SCSI_PROTOCOL_USB = 9, /* USB Attached SCSI (UAS), and others */
SCSI_PROTOCOL_UNSPEC = 0xa, /* No specific protocol */
@ -165,10 +165,10 @@ index 960ea024..9130efb5 100644
extern const char * const protocol_name[];
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 61d2712b..1f5a40b6 100644
index e1a787d4..7af53588 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1369,7 +1369,9 @@ Regular expression for the protocol of a device to be excluded/included.
@@ -1395,7 +1395,9 @@ Regular expression for the protocol of a device to be excluded/included.
The protocol strings that multipath recognizes are \fIscsi:fcp\fR,
\fIscsi:spi\fR, \fIscsi:ssa\fR, \fIscsi:sbp\fR, \fIscsi:srp\fR,
\fIscsi:iscsi\fR, \fIscsi:sas\fR, \fIscsi:adt\fR, \fIscsi:ata\fR,
@ -179,7 +179,7 @@ index 61d2712b..1f5a40b6 100644
The protocol that a path is using can be viewed by running
\fBmultipathd show paths format "%d %P"\fR
.RE
@@ -1757,8 +1759,10 @@ The protocol subsection recognizes the following mandatory attribute:
@@ -1783,8 +1785,10 @@ The protocol subsection recognizes the following mandatory attribute:
The protocol string of the path device. The possible values are \fIscsi:fcp\fR,
\fIscsi:spi\fR, \fIscsi:ssa\fR, \fIscsi:sbp\fR, \fIscsi:srp\fR,
\fIscsi:iscsi\fR, \fIscsi:sas\fR, \fIscsi:adt\fR, \fIscsi:ata\fR,

View File

@ -28,20 +28,20 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 8e1bc488..c341793c 100644
index c6803b40..193bf27d 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -297,6 +297,7 @@ int setup_map(struct multipath *mpp, char *params, int params_size,
struct vectors *vecs)
@@ -296,6 +296,7 @@ static int wait_for_pending_paths(struct multipath *mpp,
int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
{
struct pathgroup * pgp;
+ struct path *pp;
struct config *conf;
int i, n_paths, marginal_pathgroups;
@@ -308,6 +309,14 @@ int setup_map(struct multipath *mpp, char *params, int params_size,
return 1;
}
char *save_attr;
@@ -311,6 +312,14 @@ int setup_map(struct multipath *mpp, char **params, struct vectors *vecs)
if (mpp->disable_queueing && VECTOR_SIZE(mpp->paths) != 0)
mpp->disable_queueing = 0;
+ /* Force QUEUE_MODE_BIO for maps with nvme:tcp paths */
+ vector_foreach_slot(mpp->paths, pp, i) {
@ -52,9 +52,9 @@ index 8e1bc488..c341793c 100644
+ }
+ }
/*
* free features, selector, and hwhandler properties if they are being reused
*/
@@ -1161,6 +1170,13 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
* If this map was created with add_map_without_path(),
* mpp->hwe might not be set yet.
@@ -1191,6 +1200,13 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
continue;
}
@ -68,22 +68,22 @@ index 8e1bc488..c341793c 100644
/*
* at this point, we know we really got a new mp
*/
@@ -1199,7 +1215,6 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
@@ -1229,7 +1245,6 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
}
verify_paths(mpp, vecs);
verify_paths(mpp);
- cmpp = find_mp_by_wwid(curmp, mpp->wwid);
if (cmpp)
mpp->queue_mode = cmpp->queue_mode;
params[0] = '\0';
if (setup_map(mpp, &params, vecs)) {
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 8137ea21..24ac022e 100644
index 85d97ac1..4a32b405 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -68,6 +68,13 @@ int adopt_paths(vector pathvec, struct multipath *mpp)
pp->dev, mpp->alias);
continue;
@@ -262,6 +262,13 @@ int adopt_paths(vector pathvec, struct multipath *mpp)
}
if (pp->initialized == INIT_REMOVED)
continue;
+ if (mpp->queue_mode == QUEUE_MODE_RQ &&
+ pp->bus == SYSFS_BUS_NVME &&
+ pp->sg_id.proto_id == NVME_PROTOCOL_TCP) {
@ -91,14 +91,14 @@ index 8137ea21..24ac022e 100644
+ pp->dev, mpp->alias);
+ continue;
+ }
condlog(3, "%s: ownership set to %s",
pp->dev, mpp->alias);
pp->mpp = mpp;
if (!mpp->paths && !(mpp->paths = vector_alloc()))
goto err;
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 1f5a40b6..cb07a62c 100644
index 7af53588..01904feb 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -462,7 +462,9 @@ Before kernel 4.20 The default depends on the kernel parameter
@@ -472,7 +472,9 @@ Before kernel 4.20 The default depends on the kernel parameter
\fBdm_mod.use_blk_mq\fR. It is \fImq\fR if the latter is set, and \fIrq\fR
otherwise. Since kernel 4.20, \fIrq\fR and \fImq\fR both correspond to
block-multiqueue. Once a multipath device has been created, its queue_mode

View File

@ -0,0 +1,33 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 29 Nov 2022 19:56:37 -0600
Subject: [PATCH] multipath.conf(5): remove io-affinity information
The multpath-tools do not support the io-affinity path selector. We
always add a repeat count as the path argument. The io-affinity selector
doesn't take one. Instead it takes a bit map of CPUs that a path can
run on. This isn't something that lends itself to the kind of
auto-assembling that multipathd does. But even if we did want to
try to support this path-selector, until we do, we shouldn't be listing
it in the multipath.conf documentation.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/multipath.conf.5 | 4 ----
1 file changed, 4 deletions(-)
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 01904feb..5e447e67 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -211,10 +211,6 @@ of outstanding I/O to the path and its relative throughput.
estimation of future service time based on the history of previous I/O submitted
to each path.
.TP
-.I "io-affinity 0"
-(Since 5.11 kernel) Choose the path for the next bunch of I/O based on a CPU to
-path mapping the user passes in and what CPU we are executing on.
-.TP
The default is: \fBservice-time 0\fR
.RE
.

View File

@ -14,10 +14,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 2 insertions(+)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index d7cd94a5..a8c9e989 100644
index 46b9f225..861d1d17 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -169,6 +169,7 @@ set_path(vector strvec, void *ptr, const char *file, int line_nr)
@@ -156,6 +156,7 @@ set_path(vector strvec, void *ptr, const char *file, int line_nr)
if ((*str_ptr)[0] != '/'){
condlog(1, "%s line %d, %s is not an absolute path. Ignoring",
file, line_nr, *str_ptr);
@ -25,7 +25,7 @@ index d7cd94a5..a8c9e989 100644
*str_ptr = old_str;
} else
free(old_str);
@@ -189,6 +190,7 @@ set_str_noslash(vector strvec, void *ptr, const char *file, int line_nr)
@@ -176,6 +177,7 @@ set_str_noslash(vector strvec, void *ptr, const char *file, int line_nr)
if (strchr(*str_ptr, '/')) {
condlog(1, "%s line %d, %s cannot contain a slash. Ignoring",
file, line_nr, *str_ptr);

View File

@ -18,10 +18,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
1 file changed, 101 insertions(+), 9 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index a8c9e989..952b33d0 100644
index 861d1d17..eb2f33a2 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -155,6 +155,58 @@ set_dir(vector strvec, void *ptr, const char *file, int line_nr)
@@ -142,6 +142,58 @@ set_dir(vector strvec, void *ptr, const char *file, int line_nr)
return 0;
}
@ -80,7 +80,7 @@ index a8c9e989..952b33d0 100644
static int
set_path(vector strvec, void *ptr, const char *file, int line_nr)
{
@@ -337,6 +389,14 @@ def_ ## option ## _handler (struct config *conf, vector strvec, \
@@ -294,6 +346,14 @@ def_ ## option ## _handler (struct config *conf, vector strvec, \
return set_int(strvec, &conf->option, minval, maxval, file, line_nr); \
}
@ -94,8 +94,8 @@ index a8c9e989..952b33d0 100644
+
#define declare_def_snprint(option, function) \
static int \
snprint_def_ ## option (struct config *conf, char * buff, int len, \
@@ -389,6 +449,17 @@ hw_ ## option ## _handler (struct config *conf, vector strvec, \
snprint_def_ ## option (struct config *conf, struct strbuf *buff, \
@@ -346,6 +406,17 @@ hw_ ## option ## _handler (struct config *conf, vector strvec, \
return set_int(strvec, &hwe->option, minval, maxval, file, line_nr); \
}
@ -113,7 +113,7 @@ index a8c9e989..952b33d0 100644
#define declare_hw_snprint(option, function) \
static int \
@@ -420,6 +491,16 @@ ovr_ ## option ## _handler (struct config *conf, vector strvec, \
@@ -377,6 +448,16 @@ ovr_ ## option ## _handler (struct config *conf, vector strvec, \
file, line_nr); \
}
@ -129,8 +129,8 @@ index a8c9e989..952b33d0 100644
+
#define declare_ovr_snprint(option, function) \
static int \
snprint_ovr_ ## option (struct config *conf, char * buff, int len, \
@@ -450,6 +531,17 @@ mp_ ## option ## _handler (struct config *conf, vector strvec, \
snprint_ovr_ ## option (struct config *conf, struct strbuf *buff, \
@@ -407,6 +488,17 @@ mp_ ## option ## _handler (struct config *conf, vector strvec, \
return set_int(strvec, &mpe->option, minval, maxval, file, line_nr); \
}
@ -147,8 +147,8 @@ index a8c9e989..952b33d0 100644
+
#define declare_mp_snprint(option, function) \
static int \
snprint_mp_ ## option (struct config *conf, char * buff, int len, \
@@ -634,13 +726,13 @@ snprint_def_marginal_pathgroups(struct config *conf, char *buff, int len,
snprint_mp_ ## option (struct config *conf, struct strbuf *buff, \
@@ -591,13 +683,13 @@ snprint_def_marginal_pathgroups(struct config *conf, struct strbuf *buff,
}
@ -165,8 +165,8 @@ index a8c9e989..952b33d0 100644
+declare_mp_arg_str_handler(selector, 1)
declare_mp_snprint(selector, print_str)
static int snprint_uid_attrs(struct config *conf, char *buff, int len,
@@ -717,13 +809,13 @@ declare_hw_snprint(prio_args, print_str)
static int snprint_uid_attrs(struct config *conf, struct strbuf *buff,
@@ -672,13 +764,13 @@ declare_hw_snprint(prio_args, print_str)
declare_mp_handler(prio_args, set_str)
declare_mp_snprint(prio_args, print_str)
@ -184,8 +184,8 @@ index a8c9e989..952b33d0 100644
declare_mp_snprint(features, print_str)
declare_def_handler(checker_name, set_str)
@@ -1894,7 +1986,7 @@ declare_hw_snprint(revision, print_str)
declare_hw_handler(bl_product, set_regex)
@@ -1857,7 +1949,7 @@ declare_hw_snprint(revision, print_str)
declare_hw_handler(bl_product, set_str)
declare_hw_snprint(bl_product, print_str)
-declare_hw_handler(hwhandler, set_str)

View File

@ -0,0 +1,38 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 30 Jan 2023 19:54:19 -0600
Subject: [PATCH] libmultipath: use select_reload_action in select_action
Since we have a function to set the action to reload, use it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 193bf27d..09d7de0f 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -771,9 +771,7 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
if (force_reload) {
mpp->force_udev_reload = 1;
- mpp->action = ACT_RELOAD;
- condlog(3, "%s: set ACT_RELOAD (forced by user)",
- mpp->alias);
+ select_reload_action(mpp, "forced by user");
return;
}
if (cmpp->size != mpp->size) {
@@ -786,9 +784,7 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
if (!is_udev_ready(cmpp) && count_active_paths(mpp) > 0) {
mpp->force_udev_reload = 1;
- mpp->action = ACT_RELOAD;
- condlog(3, "%s: set ACT_RELOAD (udev incomplete)",
- mpp->alias);
+ select_reload_action(mpp, "udev incomplete");
return;
}

View File

@ -11,35 +11,35 @@ to flush the IO because the reload will change the device size.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
libmultipath/configure.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 6e06fea2..ecf24f95 100644
index 09d7de0f..c91a8139 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -734,17 +734,18 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
@@ -769,11 +769,6 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
return;
}
- if (force_reload) {
+ if (cmpp->size != mpp->size) {
- mpp->force_udev_reload = 1;
- select_reload_action(mpp, "forced by user");
- return;
- }
if (cmpp->size != mpp->size) {
mpp->force_udev_reload = 1;
- mpp->action = ACT_RELOAD;
- condlog(3, "%s: set ACT_RELOAD (forced by user)",
+ mpp->action = ACT_RESIZE;
+ condlog(3, "%s: set ACT_RESIZE (size change)",
mpp->alias);
mpp->action = ACT_RESIZE;
@@ -782,6 +777,12 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
return;
}
- if (cmpp->size != mpp->size) {
+
+ if (force_reload) {
+ mpp->force_udev_reload = 1;
+ select_reload_action(mpp, "forced by user");
+ return;
+ }
+
if (!is_udev_ready(cmpp) && count_active_paths(mpp) > 0) {
mpp->force_udev_reload = 1;
- mpp->action = ACT_RESIZE;
- condlog(3, "%s: set ACT_RESIZE (size change)",
+ mpp->action = ACT_RELOAD;
+ condlog(3, "%s: set ACT_RELOAD (forced by user)",
mpp->alias);
return;
}
select_reload_action(mpp, "udev incomplete");

View File

@ -11,10 +11,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 17 insertions(+), 21 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index ecf24f95..303d2380 100644
index c91a8139..24d051dd 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -693,33 +693,29 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
@@ -728,33 +728,29 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
cmpp = find_mp_by_wwid(curmp, mpp->wwid);
cmpp_by_name = find_mp_by_alias(curmp, mpp->alias);

View File

@ -15,15 +15,25 @@ rename, and do both if necessary.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/configure.c | 92 +++++++++++++++++++++-------------------
libmultipath/configure.h | 4 +-
2 files changed, 51 insertions(+), 45 deletions(-)
libmultipath/configure.c | 62 +++++++++++++++++-----------------------
libmultipath/configure.h | 4 ++-
2 files changed, 30 insertions(+), 36 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 303d2380..65a0b208 100644
index 24d051dd..bbdbb8ca 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -690,6 +690,7 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
@@ -714,7 +714,8 @@ static bool is_udev_ready(struct multipath *cmpp)
static void
select_reload_action(struct multipath *mpp, const char *reason)
{
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (%s)", mpp->alias, reason);
}
@@ -725,6 +726,7 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
struct multipath * cmpp_by_name;
char * mpp_feat, * cmpp_feat;
@ -31,7 +41,7 @@ index 303d2380..65a0b208 100644
cmpp = find_mp_by_wwid(curmp, mpp->wwid);
cmpp_by_name = find_mp_by_alias(curmp, mpp->alias);
@@ -712,14 +713,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
@@ -747,14 +749,8 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
mpp->alias);
strlcpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
mpp->action = ACT_RENAME;
@ -48,7 +58,7 @@ index 303d2380..65a0b208 100644
condlog(2, "%s: unable to rename %s to %s (%s is used by %s)",
mpp->wwid, cmpp->alias, mpp->alias,
mpp->alias, cmpp_by_name->wwid);
@@ -727,12 +722,13 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
@@ -762,12 +758,13 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
FREE(mpp->alias);
mpp->alias = STRDUP(cmpp->alias);
mpp->action = ACT_IMPOSSIBLE;
@ -64,94 +74,7 @@ index 303d2380..65a0b208 100644
condlog(3, "%s: set ACT_RESIZE (size change)",
mpp->alias);
return;
@@ -740,7 +736,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
if (force_reload) {
mpp->force_udev_reload = 1;
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (forced by user)",
mpp->alias);
return;
@@ -749,7 +746,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
!!strstr(mpp->features, "queue_if_no_path") !=
!!strstr(cmpp->features, "queue_if_no_path")) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (no_path_retry change)",
mpp->alias);
return;
@@ -759,7 +757,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
(strlen(cmpp->hwhandler) != strlen(mpp->hwhandler) ||
strncmp(cmpp->hwhandler, mpp->hwhandler,
strlen(mpp->hwhandler)))) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (hwhandler change)",
mpp->alias);
return;
@@ -769,7 +768,8 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
!!strstr(mpp->features, "retain_attached_hw_handler") !=
!!strstr(cmpp->features, "retain_attached_hw_handler") &&
get_linux_version_code() < KERNEL_VERSION(4, 3, 0)) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (retain_hwhandler change)",
mpp->alias);
return;
@@ -783,9 +783,13 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
remove_feature(&cmpp_feat, "queue_if_no_path");
remove_feature(&cmpp_feat, "retain_attached_hw_handler");
if (strncmp(mpp_feat, cmpp_feat, PARAMS_SIZE)) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ?
+ ACT_RELOAD_RENAME : ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (features change)",
mpp->alias);
+ FREE(cmpp_feat);
+ FREE(mpp_feat);
+ return;
}
}
FREE(cmpp_feat);
@@ -793,44 +797,49 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
if (!cmpp->selector || strncmp(cmpp->selector, mpp->selector,
strlen(mpp->selector))) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (selector change)",
mpp->alias);
return;
}
if (cmpp->minio != mpp->minio) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (minio change, %u->%u)",
mpp->alias, cmpp->minio, mpp->minio);
return;
}
if (!cmpp->pg || VECTOR_SIZE(cmpp->pg) != VECTOR_SIZE(mpp->pg)) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (path group number change)",
mpp->alias);
return;
}
if (pgcmp(mpp, cmpp)) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_RELOAD_RENAME :
+ ACT_RELOAD;
condlog(3, "%s: set ACT_RELOAD (path group topology change)",
mpp->alias);
@@ -843,14 +840,14 @@ void select_action (struct multipath *mpp, const struct _vector *curmp,
return;
}
if (cmpp->nextpg != mpp->bestpg) {
@ -162,14 +85,6 @@ index 303d2380..65a0b208 100644
mpp->alias);
return;
}
if (!is_mpp_known_to_udev(cmpp)) {
- mpp->action = ACT_RELOAD;
+ mpp->action = mpp->action == ACT_RENAME ? ACT_SWITCHPG_RENAME :
+ ACT_SWITCHPG;
condlog(3, "%s: set ACT_RELOAD (udev device not initialized)",
mpp->alias);
return;
}
- mpp->action = ACT_NOTHING;
- condlog(3, "%s: set ACT_NOTHING (map unchanged)",
- mpp->alias);
@ -178,8 +93,8 @@ index 303d2380..65a0b208 100644
return;
}
@@ -924,6 +933,17 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
mpp->action = ACT_RELOAD;
@@ -951,6 +948,17 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
}
}
+ if (mpp->action == ACT_RENAME || mpp->action == ACT_SWITCHPG_RENAME ||
@ -196,7 +111,7 @@ index 303d2380..65a0b208 100644
switch (mpp->action) {
case ACT_REJECT:
case ACT_NOTHING:
@@ -931,6 +951,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
@@ -958,6 +966,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
return DOMAP_EXIST;
case ACT_SWITCHPG:
@ -204,7 +119,7 @@ index 303d2380..65a0b208 100644
dm_switchgroup(mpp->alias, mpp->bestpg);
/*
* we may have avoided reinstating paths because there where in
@@ -957,6 +978,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
@@ -984,6 +993,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
break;
case ACT_RELOAD:
@ -212,7 +127,7 @@ index 303d2380..65a0b208 100644
sysfs_set_max_sectors_kb(mpp, 1);
if (mpp->ghost_delay_tick > 0 && pathcount(mpp, PATH_UP))
mpp->ghost_delay_tick = 0;
@@ -964,6 +986,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
@@ -991,6 +1001,7 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
break;
case ACT_RESIZE:
@ -220,7 +135,7 @@ index 303d2380..65a0b208 100644
sysfs_set_max_sectors_kb(mpp, 1);
if (mpp->ghost_delay_tick > 0 && pathcount(mpp, PATH_UP))
mpp->ghost_delay_tick = 0;
@@ -971,29 +994,10 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
@@ -998,29 +1009,10 @@ int domap(struct multipath *mpp, char *params, int is_daemon)
break;
case ACT_RENAME:
@ -252,7 +167,7 @@ index 303d2380..65a0b208 100644
}
diff --git a/libmultipath/configure.h b/libmultipath/configure.h
index 5cf08d45..1a93f49d 100644
index 2bf73e65..9d935db3 100644
--- a/libmultipath/configure.h
+++ b/libmultipath/configure.h
@@ -18,9 +18,11 @@ enum actions {

View File

@ -0,0 +1,70 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 7 Feb 2023 15:39:26 -0600
Subject: [PATCH] multipath.rules: fix "smart" bug with failed valid path check
If "multipath -u" fails, udev doesn't import any values from the
program. This means that multipath.rules will continue to use the values
for DM_MULTIPATH_DEVICE_PATH and FIND_MULTIPATHS_WAIT_UNTIL that it has
already imported from the database. This is the correct thing to do for
every case except the MAYBE case for "find_multipaths smart". In that
case, DM_MULTIPATH_DEVICE_PATH will be set to 1, and the rules will
assume that the device has been definitively claimed.
In this case, we know that the device shouldn't have been claimed
before, but we don't know if it should be claimed now, or if we have hit
the timeout and it should be released, since we didn't get any
information from multipath. The safest thing to do is assume that this
was the timeout, and the device shouldn't be claimed. The only time when
this could be the wrong answer is when we first see a new multipath
device, and it could only cause problems if there is metadata on the
device that will cause it to get autoassembled by something else, before
multipathd can autoassemble it. If we assume that it is a multipath
device, or we assume that this wasn't actually the timeout uevent, we
can keep a necessary device from getting released to the reset of the
system.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/multipath.rules.in | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/multipath/multipath.rules.in b/multipath/multipath.rules.in
index 5c4447a2..70b69a06 100644
--- a/multipath/multipath.rules.in
+++ b/multipath/multipath.rules.in
@@ -32,7 +32,8 @@ IMPORT{db}="DM_MULTIPATH_DEVICE_PATH"
# multipath -u sets DM_MULTIPATH_DEVICE_PATH and,
# if "find_multipaths smart", also FIND_MULTIPATHS_WAIT_UNTIL.
-IMPORT{program}="$env{MPATH_SBIN_PATH}/multipath -u %k"
+IMPORT{program}=="$env{MPATH_SBIN_PATH}/multipath -u %k", \
+ ENV{.MPATH_CHECK_PASSED}="1"
# case 1: this is definitely multipath
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", \
@@ -83,10 +84,19 @@ LABEL="stop_wait"
# If timeout hasn't expired but we're not in "maybe" state any more, stop timer
# Do this only once, and only if the timer has been started before
IMPORT{db}="FIND_MULTIPATHS_WAIT_CANCELLED"
-ENV{FIND_MULTIPATHS_WAIT_CANCELLED}!="?*", \
- ENV{FIND_MULTIPATHS_WAIT_UNTIL}=="?*", \
- ENV{FIND_MULTIPATHS_WAIT_UNTIL}!="0", \
- ENV{FIND_MULTIPATHS_WAIT_CANCELLED}="1", \
- RUN+="/usr/bin/systemctl stop cancel-multipath-wait-$kernel.timer"
+ENV{FIND_MULTIPATHS_WAIT_CANCELLED}=="?*", GOTO="end_mpath"
+ENV{FIND_MULTIPATHS_WAIT_UNTIL}!="?*", GOTO="end_mpath"
+ENV{FIND_MULTIPATHS_WAIT_UNTIL}=="0", GOTO="end_mpath"
+
+ENV{FIND_MULTIPATHS_WAIT_CANCELLED}="1"
+RUN+="/usr/bin/systemctl stop cancel-multipath-wait-$kernel.timer"
+
+# If "multipath -u" failed, no values are imported from the program,
+# and we are still using the values for DM_MULTIPATH_DEVICE_PATH and
+# FIND_MULTIPATHS_WAIT_UNTIL that were imported from the database.
+# If we are in "smart" mode, we need to give up on the path now,
+# since this may have been the timeout event. Without the imports
+# from "multipath -u", we can't tell.
+ENV{.MPATH_CHECK_PASSED}!="?*", ENV{DM_MULTIPATH_DEVICE_PATH}="0"
LABEL="end_mpath"

View File

@ -0,0 +1,64 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 8 Feb 2023 19:31:02 -0600
Subject: [PATCH] libmultipath: limit paths that can get wwid from environment
Currently, whenever getting the uid_attribute from udev database fails,
multipath will try to get it from the environment variables. This
normally isn't a problem, since either multipath -u is getting called
from a uevent, and the environment will have the correct value in that
variable, or that variable won't be set. However, when find_multipaths
is configured to "smart", this causes problems. For maybe devices,
multipath needs to get the WWIDs of all the other block devices, to see
if they match the maybe device wwid. If one of those devices doesn't
have uid_attribute set in its udev database, multipath will check the
environment for it, and it will find that variable set to the WWID
of the maybe device that this uevent is for. This means that all
devices with no WWID will end up appearing to have the same WWID as
the maybe device, causing multipath to incorrectly claim it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 2 +-
libmultipath/structs.h | 1 +
multipath/main.c | 2 ++
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index f593a7bf..a592a54e 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -2032,7 +2032,7 @@ get_udev_uid(struct path * pp, char *uid_attribute, struct udev_device *udev)
const char *value;
value = udev_device_get_property_value(udev, uid_attribute);
- if (!value || strlen(value) == 0)
+ if ((!value || strlen(value) == 0) && pp->can_use_env_uid)
value = getenv(uid_attribute);
if (value && strlen(value)) {
len = strlcpy(pp->wwid, value, WWID_SIZE);
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 0867b91d..4b308561 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -360,6 +360,7 @@ struct path {
int fast_io_fail;
unsigned int dev_loss;
int eh_deadline;
+ bool can_use_env_uid;
/* configlet pointers */
vector hwe;
struct gen_path generic_path;
diff --git a/multipath/main.c b/multipath/main.c
index 41d01c7e..e056c51c 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -653,6 +653,8 @@ check_path_valid(const char *name, struct config *conf, bool is_uevent)
pp = alloc_path();
if (!pp)
return RTVL_FAIL;
+ if (is_uevent)
+ pp->can_use_env_uid = true;
r = is_path_valid(name, conf, pp, is_uevent);
if (r <= PATH_IS_ERROR || r >= PATH_MAX_VALID_RESULT)

View File

@ -46,14 +46,14 @@ currently set, it will register the key on all paths.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/main.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
multipathd/main.c | 43 +++++++++++++++++++++++++++++--------------
1 file changed, 29 insertions(+), 14 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 769dcaee..d84027dc 100644
index a098f3c2..e7c17182 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -511,6 +511,21 @@ flush_map_nopaths(struct multipath *mpp, struct vectors *vecs) {
@@ -512,13 +512,26 @@ flush_map_nopaths(struct multipath *mpp, struct vectors *vecs) {
return false;
}
@ -75,7 +75,30 @@ index 769dcaee..d84027dc 100644
static int
update_map (struct multipath *mpp, struct vectors *vecs, int new_map)
{
@@ -556,6 +571,11 @@ fail:
int retries = 3;
char *params __attribute__((cleanup(cleanup_charp))) = NULL;
- struct path *pp;
- int i;
retry:
condlog(4, "%s: updating new map", mpp->alias);
@@ -535,15 +548,6 @@ retry:
mpp->action = ACT_RELOAD;
- if (mpp->prflag) {
- vector_foreach_slot(mpp->paths, pp, i) {
- if ((pp->state == PATH_UP) || (pp->state == PATH_GHOST)) {
- /* persistent reseravtion check*/
- mpath_pr_event_handle(pp);
- }
- }
- }
-
if (setup_map(mpp, &params, vecs)) {
condlog(0, "%s: failed to setup new map in update", mpp->alias);
retries = -1;
@@ -569,6 +573,11 @@ fail:
sync_map_state(mpp);
@ -87,7 +110,7 @@ index 769dcaee..d84027dc 100644
if (retries < 0)
condlog(0, "%s: failed reload in new map update", mpp->alias);
return 0;
@@ -1014,6 +1034,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
@@ -1073,6 +1082,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int start_waiter = 0;
int ret;
int ro;
@ -95,16 +118,16 @@ index 769dcaee..d84027dc 100644
/*
* need path UID to go any further
@@ -1056,6 +1077,8 @@ rescan:
@@ -1116,6 +1126,8 @@ rescan:
verify_paths(mpp, vecs);
verify_paths(mpp);
mpp->action = ACT_RELOAD;
+ prflag = mpp->prflag;
+ mpath_pr_event_handle(pp);
} else {
if (!should_multipath(pp, vecs->pathvec, vecs->mpvec)) {
orphan_path(pp, "only one path");
@@ -1074,9 +1097,6 @@ rescan:
@@ -1134,9 +1146,6 @@ rescan:
goto fail; /* leave path added to pathvec */
}
@ -114,7 +137,7 @@ index 769dcaee..d84027dc 100644
/* ro check - if new path is ro, force map to be ro as well */
ro = sysfs_get_ro(pp);
if (ro == 1)
@@ -1140,6 +1160,10 @@ rescan:
@@ -1201,6 +1210,10 @@ rescan:
sync_map_state(mpp);
if (retries >= 0) {
@ -125,7 +148,7 @@ index 769dcaee..d84027dc 100644
condlog(2, "%s [%s]: path added to devmap %s",
pp->dev, pp->dev_t, mpp->alias);
return 0;
@@ -2608,6 +2632,8 @@ configure (struct vectors * vecs)
@@ -2745,6 +2758,8 @@ configure (struct vectors * vecs)
if (remember_wwid(mpp->wwid) == 1)
trigger_paths_udev_change(mpp, true);
update_map_pr(mpp);

View File

@ -16,10 +16,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
4 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index d0744773..e361435a 100644
index 803a2a28..01e8ca25 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -949,7 +949,7 @@ int update_map_pr(struct multipath *mpp)
@@ -924,7 +924,7 @@ int update_map_pr(struct multipath *mpp)
if (isFound)
{
@ -29,10 +29,10 @@ index d0744773..e361435a 100644
}
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 44980b4e..8acea3cb 100644
index 4b308561..5ec591bc 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -377,6 +377,12 @@ struct path {
@@ -368,6 +368,12 @@ struct path {
typedef int (pgpolicyfn) (struct multipath *, vector);
@ -45,7 +45,7 @@ index 44980b4e..8acea3cb 100644
struct multipath {
char wwid[WWID_SIZE];
char alias_old[WWID_SIZE];
@@ -450,7 +456,7 @@ struct multipath {
@@ -441,7 +447,7 @@ struct multipath {
int prkey_source;
struct be64 reservation_key;
uint8_t sa_flags;
@ -55,10 +55,10 @@ index 44980b4e..8acea3cb 100644
struct gen_multipath generic_mp;
bool fpin_must_reload;
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 8b4bd187..6dbbb7e2 100644
index 6d3a0ae2..90d2c388 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -1407,6 +1407,10 @@ cli_shutdown (void * v, char ** reply, int * len, void * data)
@@ -1304,6 +1304,10 @@ cli_shutdown (void * v, char ** reply, int * len, void * data)
int
cli_getprstatus (void * v, char ** reply, int * len, void * data)
{
@ -69,7 +69,7 @@ index 8b4bd187..6dbbb7e2 100644
struct multipath * mpp;
struct vectors * vecs = (struct vectors *)data;
char * param = get_keyparam(v, MAP);
@@ -1418,9 +1422,7 @@ cli_getprstatus (void * v, char ** reply, int * len, void * data)
@@ -1315,9 +1319,7 @@ cli_getprstatus (void * v, char ** reply, int * len, void * data)
if (!mpp)
return 1;
@ -80,7 +80,7 @@ index 8b4bd187..6dbbb7e2 100644
if (*len < 0)
return 1;
@@ -1443,8 +1445,8 @@ cli_setprstatus(void * v, char ** reply, int * len, void * data)
@@ -1340,8 +1342,8 @@ cli_setprstatus(void * v, char ** reply, int * len, void * data)
if (!mpp)
return 1;
@ -91,7 +91,7 @@ index 8b4bd187..6dbbb7e2 100644
condlog(2, "%s: prflag set", param);
}
@@ -1466,8 +1468,8 @@ cli_unsetprstatus(void * v, char ** reply, int * len, void * data)
@@ -1363,8 +1365,8 @@ cli_unsetprstatus(void * v, char ** reply, int * len, void * data)
if (!mpp)
return 1;
@ -103,10 +103,10 @@ index 8b4bd187..6dbbb7e2 100644
}
diff --git a/multipathd/main.c b/multipathd/main.c
index d84027dc..81bb0deb 100644
index e7c17182..532ca15b 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -571,9 +571,9 @@ fail:
@@ -573,9 +573,9 @@ fail:
sync_map_state(mpp);
@ -118,7 +118,7 @@ index d84027dc..81bb0deb 100644
pr_register_active_paths(mpp);
if (retries < 0)
@@ -1034,7 +1034,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
@@ -1082,7 +1082,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int start_waiter = 0;
int ret;
int ro;
@ -127,7 +127,7 @@ index d84027dc..81bb0deb 100644
/*
* need path UID to go any further
@@ -1162,7 +1162,7 @@ rescan:
@@ -1212,7 +1212,7 @@ rescan:
if (retries >= 0) {
if (start_waiter)
update_map_pr(mpp);
@ -136,7 +136,7 @@ index d84027dc..81bb0deb 100644
pr_register_active_paths(mpp);
condlog(2, "%s [%s]: path added to devmap %s",
pp->dev, pp->dev_t, mpp->alias);
@@ -2306,7 +2306,7 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
@@ -2414,7 +2414,7 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
}
if (newstate == PATH_UP || newstate == PATH_GHOST) {
@ -145,7 +145,7 @@ index d84027dc..81bb0deb 100644
/*
* Check Persistent Reservation.
*/
@@ -2632,7 +2632,7 @@ configure (struct vectors * vecs)
@@ -2758,7 +2758,7 @@ configure (struct vectors * vecs)
if (remember_wwid(mpp->wwid) == 1)
trigger_paths_udev_change(mpp, true);
update_map_pr(mpp);
@ -154,7 +154,7 @@ index d84027dc..81bb0deb 100644
pr_register_active_paths(mpp);
}
@@ -3438,7 +3438,7 @@ void * mpath_pr_event_handler_fn (void * pathp )
@@ -3668,7 +3668,7 @@ void * mpath_pr_event_handler_fn (void * pathp )
{
condlog(0,"%s: Reservation registration failed. Error: %d", pp->dev, ret);
}

View File

@ -28,10 +28,10 @@ Reviewed-by: Martin Wilck <mwilck@suse.com>
4 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index e361435a..440a329f 100644
index 01e8ca25..3fc60da2 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -904,6 +904,7 @@ int update_map_pr(struct multipath *mpp)
@@ -879,6 +879,7 @@ int update_map_pr(struct multipath *mpp)
if (!get_be64(mpp->reservation_key))
{
/* Nothing to do. Assuming pr mgmt feature is disabled*/
@ -39,7 +39,7 @@ index e361435a..440a329f 100644
condlog(4, "%s: reservation_key not set in multipath.conf",
mpp->alias);
return MPATH_PR_SUCCESS;
@@ -915,6 +916,13 @@ int update_map_pr(struct multipath *mpp)
@@ -890,6 +891,13 @@ int update_map_pr(struct multipath *mpp)
condlog(0,"%s : failed to alloc resp in update_map_pr", mpp->alias);
return MPATH_PR_OTHER;
}
@ -54,10 +54,10 @@ index e361435a..440a329f 100644
if (ret != MPATH_PR_SUCCESS )
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 8acea3cb..7f2fb944 100644
index 5ec591bc..c1e93e6e 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -379,6 +379,7 @@ typedef int (pgpolicyfn) (struct multipath *, vector);
@@ -370,6 +370,7 @@ typedef int (pgpolicyfn) (struct multipath *, vector);
enum prflag_value {
@ -66,10 +66,10 @@ index 8acea3cb..7f2fb944 100644
PRFLAG_SET,
};
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 6dbbb7e2..260b7a17 100644
index 90d2c388..f322f10f 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -1408,6 +1408,7 @@ int
@@ -1305,6 +1305,7 @@ int
cli_getprstatus (void * v, char ** reply, int * len, void * data)
{
static const char * const prflag_str[] = {
@ -78,10 +78,10 @@ index 6dbbb7e2..260b7a17 100644
[PRFLAG_SET] = "set\n",
};
diff --git a/multipathd/main.c b/multipathd/main.c
index 81bb0deb..e7dad6b9 100644
index 532ca15b..075e7b13 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -571,7 +571,7 @@ fail:
@@ -573,7 +573,7 @@ fail:
sync_map_state(mpp);
@ -90,7 +90,7 @@ index 81bb0deb..e7dad6b9 100644
update_map_pr(mpp);
if (mpp->prflag == PRFLAG_SET)
pr_register_active_paths(mpp);
@@ -1162,7 +1162,7 @@ rescan:
@@ -1212,7 +1212,7 @@ rescan:
if (retries >= 0) {
if (start_waiter)
update_map_pr(mpp);
@ -99,7 +99,7 @@ index 81bb0deb..e7dad6b9 100644
pr_register_active_paths(mpp);
condlog(2, "%s [%s]: path added to devmap %s",
pp->dev, pp->dev_t, mpp->alias);
@@ -2306,13 +2306,17 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
@@ -2414,13 +2414,17 @@ check_path (struct vectors * vecs, struct path * pp, unsigned int ticks)
}
if (newstate == PATH_UP || newstate == PATH_GHOST) {
@ -118,7 +118,7 @@ index 81bb0deb..e7dad6b9 100644
}
}
@@ -3386,6 +3390,7 @@ void * mpath_pr_event_handler_fn (void * pathp )
@@ -3616,6 +3620,7 @@ void * mpath_pr_event_handler_fn (void * pathp )
goto out;
}
@ -126,7 +126,7 @@ index 81bb0deb..e7dad6b9 100644
ret = prin_do_scsi_ioctl(pp->dev, MPATH_PRIN_RKEY_SA, resp, 0);
if (ret != MPATH_PR_SUCCESS )
{
@@ -3456,12 +3461,12 @@ int mpath_pr_event_handle(struct path *pp)
@@ -3686,12 +3691,12 @@ int mpath_pr_event_handle(struct path *pp)
struct multipath * mpp;
if (pp->bus != SYSFS_BUS_SCSI)
@ -141,7 +141,7 @@ index 81bb0deb..e7dad6b9 100644
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
@@ -3474,4 +3479,8 @@ int mpath_pr_event_handle(struct path *pp)
@@ -3704,4 +3709,8 @@ int mpath_pr_event_handle(struct path *pp)
pthread_attr_destroy(&attr);
rc = pthread_join(thread, NULL);
return 0;

View File

@ -16,10 +16,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 440a329f..a4c1461f 100644
index 3fc60da2..29b64937 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -899,7 +899,7 @@ int update_map_pr(struct multipath *mpp)
@@ -874,7 +874,7 @@ int update_map_pr(struct multipath *mpp)
int noisy=0;
struct prin_resp *resp;
unsigned int i;
@ -28,7 +28,7 @@ index 440a329f..a4c1461f 100644
if (!get_be64(mpp->reservation_key))
{
@@ -920,7 +920,7 @@ int update_map_pr(struct multipath *mpp)
@@ -895,7 +895,7 @@ int update_map_pr(struct multipath *mpp)
{
condlog(0,"%s: No available paths to check pr status",
mpp->alias);
@ -37,7 +37,7 @@ index 440a329f..a4c1461f 100644
}
mpp->prflag = PRFLAG_UNSET;
ret = mpath_prin_activepath(mpp, MPATH_PRIN_RKEY_SA, resp, noisy);
@@ -928,15 +928,15 @@ int update_map_pr(struct multipath *mpp)
@@ -903,15 +903,15 @@ int update_map_pr(struct multipath *mpp)
if (ret != MPATH_PR_SUCCESS )
{
condlog(0,"%s : pr in read keys service action failed Error=%d", mpp->alias, ret);
@ -57,7 +57,7 @@ index 440a329f..a4c1461f 100644
}
condlog(2, "%s: Multipath reservation_key: 0x%" PRIx64 " ", mpp->alias,
@@ -961,6 +961,7 @@ int update_map_pr(struct multipath *mpp)
@@ -936,6 +936,7 @@ int update_map_pr(struct multipath *mpp)
condlog(2, "%s: prflag flag set.", mpp->alias );
}

View File

@ -0,0 +1,186 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 7 Jul 2023 15:25:59 -0500
Subject: [PATCH] RH: Add mpathcleanup
mpathcleanup is a program that will remove a multipath device as well as
all of the scsi path devices that make it up.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/Makefile | 2 +
multipath/mpathcleanup | 145 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 147 insertions(+)
create mode 100755 multipath/mpathcleanup
diff --git a/multipath/Makefile b/multipath/Makefile
index f3d98012..1fc04c8d 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -24,6 +24,7 @@ install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 755 $(EXEC) $(DESTDIR)$(bindir)/
$(INSTALL_PROGRAM) -m 755 mpathconf $(DESTDIR)$(bindir)/
+ $(INSTALL_PROGRAM) -m 755 mpathcleanup $(DESTDIR)$(bindir)/
$(INSTALL_PROGRAM) -d $(DESTDIR)$(udevrulesdir)
$(INSTALL_PROGRAM) -m 644 11-dm-mpath.rules $(DESTDIR)$(udevrulesdir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).rules $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
@@ -40,6 +41,7 @@ uninstall:
$(RM) $(DESTDIR)$(udevrulesdir)/11-dm-mpath.rules
$(RM) $(DESTDIR)$(libudevdir)/rules.d/62-multipath.rules
$(RM) $(DESTDIR)$(bindir)/mpathconf
+ $(RM) $(DESTDIR)$(bindir)/mpathcleanup
$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz
$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
$(RM) $(DESTDIR)$(man8dir)/mpathconf.8.gz
diff --git a/multipath/mpathcleanup b/multipath/mpathcleanup
new file mode 100755
index 00000000..6fd921e4
--- /dev/null
+++ b/multipath/mpathcleanup
@@ -0,0 +1,145 @@
+#!/bin/bash
+#
+# Copyright (C) 2023 Red Hat, Inc. All rights reserved.
+#
+# This file is part of the device-mapper-multipath package.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+unset PROGRAM FLUSH DEVICE DEVNAME MAJOR MINOR PATHDEVS PATHDEV HAVE_MULTIPATHD QUEUEING
+
+function usage
+{
+ echo "usage: $PROGRAM [-h] [--flush] <device>"
+ echo ""
+ echo "remove a multipath device and its scsi path devices"
+ echo ""
+ echo "options:"
+ echo " -h, --help show this help message and exit"
+ echo " --flush disable queuing on the multipath device and"
+ echo " flush the path devices before removing"
+}
+
+function parse_args
+{
+ while [ -n "$1" ]; do
+ case $1 in
+ --flush)
+ FLUSH=1
+ shift
+ ;;
+ --help | -h)
+ usage
+ exit 1
+ ;;
+ *)
+ if [ -n "$DEVICE" ]; then
+ usage
+ exit 1
+ fi
+ DEVICE=$1
+ shift
+ ;;
+ esac
+ done
+}
+
+function validate_device
+{
+ if [ -z "$DEVICE" ]; then
+ usage
+ exit 1
+ fi
+ if [[ "$DEVICE" =~ ^[[:digit:]]+:[[:digit:]]+$ ]]; then
+ MAJOR=${DEVICE%%:*}
+ MINOR=${DEVICE##*:}
+ DEVNAME=`dmsetup ls --target multipath | grep "($MAJOR, $MINOR)$" | awk '{print $1}'`
+ else
+ DEVNAME=`dmsetup ls --target multipath | awk '{print $1}' | grep "^$DEVICE$"`
+ fi
+ if [ -z "$DEVNAME" ]; then
+ DEVNAME=`multipath -v 1 -l $DEVICE 2>/dev/null`
+ if [ -z "$DEVNAME" ]; then
+ echo "$DEVICE is not a multipath device"
+ exit 1
+ fi
+ # verify that this is not a native nvme multipath device
+ dmsetup ls --target multipath | awk '{print $1}' | grep -q "^$DEVNAME$"
+ if test $? -eq 1; then
+ echo "$DEVICE is not a device-mapper multipath device"
+ exit 1
+ fi
+ fi
+ if [ -z "$MINOR" ]; then
+ MINOR=`dmsetup info -c --noheadings -o minor $DEVNAME`
+ fi
+}
+
+function get_paths
+{
+ PATHDEVS=`ls /sys/block/dm-$MINOR/slaves`
+ for PATHDEV in $PATHDEVS; do
+ if [[ ! "$PATHDEV" =~ ^sd[a-z]+$ ]]; then
+ echo "$PATHDEV is not a scsi device. $PROGRAM only works with scsi devices"
+ exit 1
+ fi
+ done
+}
+
+function remove_devs
+{
+ pidof multipathd > /dev/null
+ HAVE_MULTIPATHD=$?
+ multipath -v2 -l "$DEVNAME" | grep features | grep -q queue_if_no_path
+ QUEUEING=$?
+ if [ -n "$FLUSH" ] && [ "$QUEUEING" -eq 0 ]; then
+ if test $HAVE_MULTIPATHD -eq 0; then
+ multipathd disablequeueing map "$DEVNAME" > /dev/null
+ else
+ dmsetup message "$DEVNAME" 0 fail_if_no_path
+ fi
+ sleep 1
+ fi
+ if test $HAVE_MULTIPATHD -eq 0; then
+ multipath -f "$DEVNAME"
+ else
+ multipathd -Df "$DEVNAME"
+ fi
+ if test $? -eq 1; then
+ echo "$DEVICE cannot be removed"
+ exit 1
+ fi
+ for PATHDEV in $PATHDEVS; do
+ if [ -n "$FLUSH" ]; then
+ blockdev --flushbufs /dev/"$PATHDEV"
+ fi
+ echo 1 > /sys/block/"$PATHDEV"/device/delete
+ done
+}
+
+function verify_removal
+{
+ multipath -v 1 -d $DEVNAME | grep -q "^$DEVNAME$"
+ if test $? -eq 0; then
+ echo "$DEVICE removed but path devices still exist"
+ exit 1
+ fi
+ multipath -v 1 -l $DEVNAME | grep -q "^$DEVNAME$"
+ if test $? -eq 0; then
+ echo "$DEVICE removal succeeded, but device still exists"
+ exit 1
+ fi
+}
+
+PROGRAM="$0"
+parse_args "$@"
+validate_device
+get_paths
+remove_devs
+verify_removal

View File

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 12 Jul 2023 12:56:48 -0500
Subject: [PATCH] RH: make listing return an error if the config file is
missing
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/multipath/main.c b/multipath/main.c
index e056c51c..f1077421 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -874,11 +874,14 @@ main (int argc, char *argv[])
struct config *conf;
int retries = -1;
bool enable_foreign = false;
+ bool have_config;
+ struct stat buf;
libmultipath_init();
if (atexit(dm_lib_exit) || atexit(libmultipath_exit))
condlog(1, "failed to register cleanup handler for libmultipath: %m");
logsink = LOGSINK_STDERR_WITH_TIME;
+ have_config = (stat(DEFAULT_CONFIGFILE, &buf) == 0);
if (init_config(DEFAULT_CONFIGFILE))
exit(RTVL_FAIL);
if (atexit(uninit_config))
@@ -1129,6 +1132,9 @@ main (int argc, char *argv[])
while ((r = configure(conf, cmd, dev_type, dev)) == RTVL_RETRY)
condlog(3, "restart multipath configuration process");
+ if (!have_config && r == RTVL_OK &&
+ (cmd == CMD_LIST_SHORT || cmd == CMD_LIST_LONG))
+ r = RTVL_FAIL;
out:
put_multipath_config(conf);
if (dev)

View File

@ -0,0 +1,300 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Muneendra <muneendra.kumar@broadcom.com>
Date: Wed, 20 Sep 2023 20:41:15 -0700
Subject: [PATCH] multipathd: Added support to handle FPIN-Li events for
FC-NVMe
This patch adds the support to handle FPIN-Li for FC-NVMe.
On receiving the FPIN-Li events this patch moves the devices paths
which are affected due to link integrity to marginal path groups.
The paths which are set to marginal path group will be unset
on receiving the RSCN events
(mwilck: minor compile fix for 32-bit architectures)
Signed-off-by: Muneendra <muneendra.kumar@broadcom.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/fpin_handlers.c | 206 +++++++++++++++++++++++++++----------
1 file changed, 151 insertions(+), 55 deletions(-)
diff --git a/multipathd/fpin_handlers.c b/multipathd/fpin_handlers.c
index 571796e7..d5f7594d 100644
--- a/multipathd/fpin_handlers.c
+++ b/multipathd/fpin_handlers.c
@@ -59,18 +59,15 @@ static void _udev_device_unref(void *p)
/*set/unset the path state to marginal*/
-static int fpin_set_pathstate(struct path *pp, bool set)
+static void fpin_set_pathstate(struct path *pp, bool set)
{
const char *action = set ? "set" : "unset";
- if (!pp || !pp->mpp || !pp->mpp->alias)
- return -1;
-
- condlog(3, "\n%s: %s marginal path %s (fpin)",
- action, pp->mpp->alias, pp->dev_t);
+ condlog(3, "%s: %s marginal path %s (fpin)",
+ pp->mpp ? pp->mpp->alias : "orphan", action, pp->dev_t);
pp->marginal = set;
- pp->mpp->fpin_must_reload = true;
- return 0;
+ if (pp->mpp)
+ pp->mpp->fpin_must_reload = true;
}
/* This will unset marginal state of a device*/
@@ -81,14 +78,14 @@ static void fpin_path_unsetmarginal(char *devname, struct vectors *vecs)
pp = find_path_by_dev(vecs->pathvec, devname);
if (!pp)
pp = find_path_by_devt(vecs->pathvec, devname);
-
- fpin_set_pathstate(pp, false);
+ if (pp)
+ fpin_set_pathstate(pp, false);
}
/*This will set the marginal state of a device*/
-static int fpin_path_setmarginal(struct path *pp)
+static void fpin_path_setmarginal(struct path *pp)
{
- return fpin_set_pathstate(pp, true);
+ fpin_set_pathstate(pp, true);
}
/* Unsets all the devices in the list from marginal state */
@@ -175,8 +172,8 @@ static void fpin_set_rport_marginal(struct udev_device *rport_dev)
"Marginal", strlen("Marginal"));
}
-/*Add the marginal devices info into the list*/
-static void
+/*Add the marginal devices info into the list and return 0 on success*/
+static int
fpin_add_marginal_dev_info(uint32_t host_num, char *devname)
{
struct marginal_dev_list *newdev = NULL;
@@ -191,65 +188,160 @@ fpin_add_marginal_dev_info(uint32_t host_num, char *devname)
list_add_tail(&(newdev->node),
&fpin_li_marginal_dev_list_head);
pthread_mutex_unlock(&fpin_li_marginal_dev_mutex);
- }
+ } else
+ return -ENOMEM;
+ return 0;
}
/*
- * This function goes through the vecs->pathvec, and for
- * each path, check that the host number,
- * the target WWPN associated with the path matches
- * with the els wwpn and sets the path and port state to
+ * This function compares Transport Address Controller Port pn,
+ * Host Transport Address Controller Port pn with the els wwpn ,attached_wwpn
+ * and return 1 (match) or 0 (no match) or a negative error code
+ */
+static int extract_nvme_addresses_chk_path_pwwn(const char *address,
+ uint64_t els_wwpn, uint64_t els_attached_wwpn)
+
+{
+ uint64_t traddr;
+ uint64_t host_traddr;
+
+ /*
+ * Find the position of "traddr=" and "host_traddr="
+ * and the address will be in the below format
+ * "traddr=nn-0x200400110dff9400:pn-0x200400110dff9400,
+ * host_traddr=nn-0x200400110dff9400:pn-0x200400110dff9400"
+ */
+ const char *traddr_start = strstr(address, "traddr=");
+ const char *host_traddr_start = strstr(address, "host_traddr=");
+
+ if (!traddr_start || !host_traddr_start)
+ return -EINVAL;
+
+ /* Extract traddr pn */
+ if (sscanf(traddr_start, "traddr=nn-%*[^:]:pn-%" SCNx64, &traddr) != 1)
+ return -EINVAL;
+
+ /* Extract host_traddr pn*/
+ if (sscanf(host_traddr_start, "host_traddr=nn-%*[^:]:pn-%" SCNx64,
+ &host_traddr) != 1)
+ return -EINVAL;
+ condlog(4, "traddr 0x%" PRIx64 " hosttraddr 0x%" PRIx64 " els_wwpn 0x%"
+ PRIx64" els_host_traddr 0x%" PRIx64,
+ traddr, host_traddr,
+ els_wwpn, els_attached_wwpn);
+ if ((host_traddr == els_attached_wwpn) && (traddr == els_wwpn))
+ return 1;
+ return 0;
+}
+
+/*
+ * This function check that the Transport Address Controller Port pn,
+ * Host Transport Address Controller Port pn associated with the path matches
+ * with the els wwpn ,attached_wwpn and sets the path state to
* Marginal
*/
-static int fpin_chk_wwn_setpath_marginal(uint16_t host_num, struct vectors *vecs,
+static void fpin_check_set_nvme_path_marginal(uint16_t host_num, struct path *pp,
+ uint64_t els_wwpn, uint64_t attached_wwpn)
+{
+ struct udev_device *ctl = NULL;
+ const char *address = NULL;
+ int ret = 0;
+
+ ctl = udev_device_get_parent_with_subsystem_devtype(pp->udev, "nvme", NULL);
+ if (ctl == NULL) {
+ condlog(2, "%s: No parent device for ", pp->dev);
+ return;
+ }
+ address = udev_device_get_sysattr_value(ctl, "address");
+ if (!address) {
+ condlog(2, "%s: unable to get the address ", pp->dev);
+ return;
+ }
+ condlog(4, "\n address %s: dev :%s\n", address, pp->dev);
+ ret = extract_nvme_addresses_chk_path_pwwn(address, els_wwpn, attached_wwpn);
+ if (ret <= 0)
+ return;
+ ret = fpin_add_marginal_dev_info(host_num, pp->dev);
+ if (ret < 0)
+ return;
+ fpin_path_setmarginal(pp);
+}
+
+/*
+ * This function check the host number, the target WWPN
+ * associated with the path matches with the els wwpn and
+ * sets the path and port state to Marginal
+ */
+static void fpin_check_set_scsi_path_marginal(uint16_t host_num, struct path *pp,
uint64_t els_wwpn)
{
- struct path *pp;
- struct multipath *mpp;
- int i, k;
char rport_id[42];
const char *value = NULL;
struct udev_device *rport_dev = NULL;
uint64_t wwpn;
int ret = 0;
+ sprintf(rport_id, "rport-%d:%d-%d",
+ pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
+ rport_dev = udev_device_new_from_subsystem_sysname(udev,
+ "fc_remote_ports", rport_id);
+ if (!rport_dev) {
+ condlog(2, "%s: No fc_remote_port device for '%s'", pp->dev,
+ rport_id);
+ return;
+ }
+ pthread_cleanup_push(_udev_device_unref, rport_dev);
+ value = udev_device_get_sysattr_value(rport_dev, "port_name");
+ if (!value)
+ goto unref;
+
+ wwpn = strtol(value, NULL, 16);
+ /*
+ * If the port wwpn matches sets the path and port state
+ * to marginal
+ */
+ if (wwpn == els_wwpn) {
+ ret = fpin_add_marginal_dev_info(host_num, pp->dev);
+ if (ret < 0)
+ goto unref;
+ fpin_path_setmarginal(pp);
+ fpin_set_rport_marginal(rport_dev);
+ }
+unref:
+ pthread_cleanup_pop(1);
+ return;
+
+}
+
+/*
+ * This function goes through the vecs->pathvec, and for
+ * each path, it checks and sets the path state to marginal
+ * if the path's associated port wwpn ,hostnum matches with
+ * els wwnpn ,attached_wwpn
+ */
+static int fpin_chk_wwn_setpath_marginal(uint16_t host_num, struct vectors *vecs,
+ uint64_t els_wwpn, uint64_t attached_wwpn)
+{
+ struct path *pp;
+ struct multipath *mpp;
+ int i, k;
+ int ret = 0;
pthread_cleanup_push(cleanup_lock, &vecs->lock);
lock(&vecs->lock);
pthread_testcancel();
vector_foreach_slot(vecs->pathvec, pp, k) {
- /* Checks the host number and also for the SCSI FCP */
- if (pp->bus != SYSFS_BUS_SCSI || pp->sg_id.proto_id != SCSI_PROTOCOL_FCP || host_num != pp->sg_id.host_no)
+ if (!pp->mpp)
continue;
- sprintf(rport_id, "rport-%d:%d-%d",
- pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
- rport_dev = udev_device_new_from_subsystem_sysname(udev,
- "fc_remote_ports", rport_id);
- if (!rport_dev) {
- condlog(2, "%s: No fc_remote_port device for '%s'", pp->dev,
- rport_id);
- continue;
- }
- pthread_cleanup_push(_udev_device_unref, rport_dev);
- value = udev_device_get_sysattr_value(rport_dev, "port_name");
- if (!value)
- goto unref;
-
- if (value)
- wwpn = strtol(value, NULL, 16);
- /*
- * If the port wwpn matches sets the path and port state
- * to marginal
- */
- if (wwpn == els_wwpn) {
- ret = fpin_path_setmarginal(pp);
- if (ret < 0)
- goto unref;
- fpin_set_rport_marginal(rport_dev);
- fpin_add_marginal_dev_info(host_num, pp->dev);
+ /*checks if the bus type is nvme and the protocol is FC-NVMe*/
+ if ((pp->bus == SYSFS_BUS_NVME) && (pp->sg_id.proto_id == NVME_PROTOCOL_FC)) {
+ fpin_check_set_nvme_path_marginal(host_num, pp, els_wwpn, attached_wwpn);
+ } else if ((pp->bus == SYSFS_BUS_SCSI) &&
+ (pp->sg_id.proto_id == SCSI_PROTOCOL_FCP) &&
+ (host_num == pp->sg_id.host_no)) {
+ /* Checks the host number and also for the SCSI FCP */
+ fpin_check_set_scsi_path_marginal(host_num, pp, els_wwpn);
}
-unref:
- pthread_cleanup_pop(1);
}
/* walk backwards because reload_and_sync_map() can remove mpp */
vector_foreach_slot_backwards(vecs->mpvec, mpp, i) {
@@ -278,14 +370,18 @@ fpin_parse_li_els_setpath_marginal(uint16_t host_num, struct fc_tlv_desc *tlv,
struct fc_fn_li_desc *li_desc = (struct fc_fn_li_desc *)tlv;
int count = 0;
int ret = 0;
+ uint64_t attached_wwpn;
/* Update the wwn to list */
wwn_count = be32_to_cpu(li_desc->pname_count);
- condlog(4, "Got wwn count as %d\n", wwn_count);
+ attached_wwpn = be64_to_cpu(li_desc->attached_wwpn);
+ condlog(4, "Got wwn count as %d detecting wwn 0x%" PRIx64
+ " attached_wwpn 0x%" PRIx64 "\n",
+ wwn_count, be64_to_cpu(li_desc->detecting_wwpn), attached_wwpn);
for (iter = 0; iter < wwn_count; iter++) {
wwpn = be64_to_cpu(li_desc->pname_list[iter]);
- ret = fpin_chk_wwn_setpath_marginal(host_num, vecs, wwpn);
+ ret = fpin_chk_wwn_setpath_marginal(host_num, vecs, wwpn, attached_wwpn);
if (ret < 0)
condlog(2, "failed to set the path marginal associated with wwpn: 0x%" PRIx64 "\n", wwpn);

View File

@ -0,0 +1,31 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 26 Oct 2023 13:24:34 -0400
Subject: [PATCH] multipath-tools: add HPE Alletra 9000 NVMe to hardware table
Add config to match configuration in 0.9.6 release
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/hwtable.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
index 22ff1881..78ac7988 100644
--- a/libmultipath/hwtable.c
+++ b/libmultipath/hwtable.c
@@ -119,6 +119,14 @@ static struct hwentry default_hw[] = {
.dev_loss = MAX_DEV_LOSS_TMO,
.vpd_vendor_id = VPD_VP_HP3PAR,
},
+ {
+ /* Alletra 9000 NVMe */
+ .vendor = "NVME",
+ .product = "HPE Alletra",
+ .pgpolicy = GROUP_BY_PRIO,
+ .pgfailback = -FAILBACK_IMMEDIATE,
+ .no_path_retry = NO_PATH_RETRY_QUEUE,
+ },
{
/* RA8000 / ESA12000 */
.vendor = "DEC",

View File

@ -0,0 +1,70 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 3 Nov 2023 11:13:04 -0400
Subject: [PATCH] RH: multipath: add mpathcleanup man page
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/Makefile | 3 +++
multipath/mpathcleanup.8 | 24 ++++++++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100644 multipath/mpathcleanup.8
diff --git a/multipath/Makefile b/multipath/Makefile
index 1fc04c8d..cdfa160b 100644
--- a/multipath/Makefile
+++ b/multipath/Makefile
@@ -19,6 +19,7 @@ $(EXEC): $(OBJS) $(multipathdir)/libmultipath.so $(mpathcmddir)/libmpathcmd.so
$(GZIP) $(EXEC).8 > $(EXEC).8.gz
$(GZIP) $(EXEC).conf.5 > $(EXEC).conf.5.gz
$(GZIP) mpathconf.8 > mpathconf.8.gz
+ $(GZIP) mpathcleanup.8 > mpathcleanup.8.gz
install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(bindir)
@@ -35,6 +36,7 @@ install:
$(INSTALL_PROGRAM) -d $(DESTDIR)$(man5dir)
$(INSTALL_PROGRAM) -m 644 $(EXEC).conf.5.gz $(DESTDIR)$(man5dir)
$(INSTALL_PROGRAM) -m 644 mpathconf.8.gz $(DESTDIR)$(man8dir)
+ $(INSTALL_PROGRAM) -m 644 mpathcleanup.8.gz $(DESTDIR)$(man8dir)
uninstall:
$(RM) $(DESTDIR)$(bindir)/$(EXEC)
@@ -45,6 +47,7 @@ uninstall:
$(RM) $(DESTDIR)$(man8dir)/$(EXEC).8.gz
$(RM) $(DESTDIR)$(man5dir)/$(EXEC).conf.5.gz
$(RM) $(DESTDIR)$(man8dir)/mpathconf.8.gz
+ $(RM) $(DESTDIR)$(man8dir)/mpathcleanup.8.gz
clean: dep_clean
$(RM) core *.o $(EXEC) *.gz multipath.rules tmpfiles.conf
diff --git a/multipath/mpathcleanup.8 b/multipath/mpathcleanup.8
new file mode 100644
index 00000000..184c35c9
--- /dev/null
+++ b/multipath/mpathcleanup.8
@@ -0,0 +1,24 @@
+.TH MPATHCLEANUP 8 "November 2023" "" "Linux Administrator's Manual"
+.SH NAME
+mpathcleanup - A tool to remove a multipath device and its scsi path devices
+.SH SYNOPSIS
+.B mpathcleanup
+[\fB\-h\fR] [\fB\-\-flush\fR] \fBdevice\fR
+.SH DESCRIPTION
+\fBmpathcleanup\fR is a utility that attempts to remove a multipath device and
+its underlying paths. It only works for multipath devices built on top of scsi
+devices.
+.SH OPTIONS
+.TP
+.B \-\-flush
+Disable queueing on the multipath device and flush the path devices before
+removing.
+.TP
+\fB\-h\fR|\fB\-\-help\fR
+Display help text.
+.SH "SEE ALSO"
+.BR multipath.conf (5),
+.BR multipath (8),
+.BR multipathd (8)
+.SH AUTHOR
+Benjamin Marzinski <bmarzins@redhat.com>

View File

@ -0,0 +1,182 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 9 Nov 2023 18:46:11 -0500
Subject: [PATCH] libmultipath: Add max_retries config option
This option lets multipath set a scsi disk's max_retries sysfs value.
Setting this can be helpful for cases where the path checker succeeds,
but IO commands hang and timeout. By default, the SCSI layer will retry
IOs 5 times. Reducing this value will allow multipath to retry the IO
down another path sooner.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/config.h | 1 +
libmultipath/dict.c | 25 ++++++++++++++++++++++++
libmultipath/discovery.c | 40 +++++++++++++++++++++++++++++++++++++-
libmultipath/structs.h | 6 ++++++
multipath/multipath.conf.5 | 14 +++++++++++++
5 files changed, 85 insertions(+), 1 deletion(-)
diff --git a/libmultipath/config.h b/libmultipath/config.h
index c1e18363..b0ee8241 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -162,6 +162,7 @@ struct config {
int fast_io_fail;
unsigned int dev_loss;
int eh_deadline;
+ int max_retries;
int log_checker_err;
int allow_queueing;
int allow_usb_devices;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index eb2f33a2..0c66c1e1 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -1206,6 +1206,30 @@ declare_hw_snprint(eh_deadline, print_undef_off_zero)
declare_pc_handler(eh_deadline, set_undef_off_zero)
declare_pc_snprint(eh_deadline, print_undef_off_zero)
+static int
+def_max_retries_handler(struct config *conf, vector strvec, const char *file,
+ int line_nr)
+{
+ char * buff;
+
+ buff = set_value(strvec);
+ if (!buff)
+ return 1;
+
+ if (strcmp(buff, "off") == 0)
+ conf->max_retries = MAX_RETRIES_OFF;
+ else if (strcmp(buff, "0") == 0)
+ conf->max_retries = MAX_RETRIES_ZERO;
+ else
+ do_set_int(strvec, &conf->max_retries, 1, 5, file, line_nr,
+ buff);
+
+ free(buff);
+ return 0;
+}
+
+declare_def_snprint(max_retries, print_undef_off_zero)
+
static int
set_pgpolicy(vector strvec, void *ptr, const char *file, int line_nr)
{
@@ -2143,6 +2167,7 @@ init_keywords(vector keywords)
install_keyword("fast_io_fail_tmo", &def_fast_io_fail_handler, &snprint_def_fast_io_fail);
install_keyword("dev_loss_tmo", &def_dev_loss_handler, &snprint_def_dev_loss);
install_keyword("eh_deadline", &def_eh_deadline_handler, &snprint_def_eh_deadline);
+ install_keyword("max_retries", &def_max_retries_handler, &snprint_def_max_retries);
install_keyword("bindings_file", &def_bindings_file_handler, &snprint_def_bindings_file);
install_keyword("wwids_file", &def_wwids_file_handler, &snprint_def_wwids_file);
install_keyword("prkeys_file", &def_prkeys_file_handler, &snprint_def_prkeys_file);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a592a54e..adf8bbaa 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -632,6 +632,42 @@ sysfs_set_eh_deadline(struct path *pp)
return (ret <= 0);
}
+static int
+sysfs_set_max_retries(struct config *conf, struct path *pp)
+{
+ struct udev_device *parent;
+ char value[16];
+ STRBUF_ON_STACK(buf);
+ int ret, len;
+
+ if (conf->max_retries == MAX_RETRIES_UNSET)
+ return 0;
+
+ if (!pp->udev || pp->sg_id.host_no < 0)
+ return 1;
+
+ len = sprintf(value, "%d", (conf->max_retries == MAX_RETRIES_OFF)? -1 :
+ (conf->max_retries == MAX_RETRIES_ZERO)? 0 :
+ conf->max_retries);
+
+ parent = udev_device_get_parent_with_subsystem_devtype(pp->udev,
+ "scsi", "scsi_device");
+ if (!parent)
+ return 1;
+
+ if (print_strbuf(&buf, "scsi_disk/%i:%i:%i:%" PRIu64 "/max_retries",
+ pp->sg_id.host_no, pp->sg_id.channel,
+ pp->sg_id.scsi_id, pp->sg_id.lun) < 0)
+ return 1;
+
+ ret = sysfs_attr_set_value(parent, get_strbuf_str(&buf), value, len);
+ if (len != ret)
+ condlog(3, "%s/%s: failed to set value to %s: %s",
+ udev_device_get_sysname(parent), get_strbuf_str(&buf),
+ value, (ret < 0)? strerror(-ret) : "write underflow");
+ return (len != ret);
+}
+
static void
sysfs_set_rport_tmo(struct multipath *mpp, struct path *pp)
{
@@ -862,13 +898,15 @@ sysfs_set_scsi_tmo (struct config *conf, struct multipath *mpp)
if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET &&
- pp->eh_deadline == EH_DEADLINE_UNSET)
+ pp->eh_deadline == EH_DEADLINE_UNSET &&
+ conf->max_retries == MAX_RETRIES_UNSET)
continue;
if (pp->bus != SYSFS_BUS_SCSI)
continue;
sysfs_set_eh_deadline(pp);
+ sysfs_set_max_retries(conf, pp);
if (pp->dev_loss == DEV_LOSS_TMO_UNSET &&
pp->fast_io_fail == MP_FAST_IO_FAIL_UNSET)
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index c1e93e6e..b4252ab5 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -276,6 +276,12 @@ enum eh_deadline_states {
EH_DEADLINE_ZERO = UOZ_ZERO,
};
+enum max_retries_states {
+ MAX_RETRIES_UNSET = UOZ_UNDEF,
+ MAX_RETRIES_OFF = UOZ_OFF,
+ MAX_RETRIES_ZERO = UOZ_ZERO,
+};
+
enum recheck_wwid_states {
RECHECK_WWID_UNDEF = YNU_UNDEF,
RECHECK_WWID_OFF = YNU_NO,
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 5e447e67..789f0bfc 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -743,6 +743,20 @@ The default is: \fB<unset>\fR
.
.
.TP
+.B max_retries
+Specify the maximum number of times the SCSI layer will retry IO commands for
+some types of SCSI errors before returning failure. Setting this can be helpful
+for cases where IO commands hang and timeout. By default, the SCSI layer will
+retry IOs 5 times. Reducing this value will allow multipath to retry the IO
+down another path sooner. Valid values are
+\fB0\fR through \fB5\fR.
+.RS
+.TP
+The default is: \fB<unset>\fR
+.RE
+.
+.
+.TP
.B bindings_file
This option is deprecated, and will be removed in a future release.
The full pathname of the binding file to be used when the user_friendly_names

View File

@ -0,0 +1,29 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 9 Nov 2023 18:46:12 -0500
Subject: [PATCH] libmutipath: Retain device size if sysfs_get_size fails.
When paths are allocated their size is initialized to 0. If they've
already set a size, and a future call to sysfs_get_size() fails during
the parsing, assume that the size hasn't changed, instead of setting it
to 0. All other failures in sysfs_get_size() already retain the existing
size.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/sysfs.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/libmultipath/sysfs.c b/libmultipath/sysfs.c
index 24c12b6a..41354f91 100644
--- a/libmultipath/sysfs.c
+++ b/libmultipath/sysfs.c
@@ -229,7 +229,6 @@ sysfs_get_size (struct path *pp, unsigned long long * size)
if (r != 1) {
condlog(3, "%s: Cannot parse size attribute", pp->dev);
- *size = 0;
return 1;
}

View File

@ -0,0 +1,68 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 9 Nov 2023 18:46:13 -0500
Subject: [PATCH] multipathd: check and update all paths when in cli_resize
When resizing a multipath device, make sure that all the paths have
been updated to the new size first.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
Reviewed-by: Martin Wilck <mwilck@suse.com>
---
multipathd/cli_handlers.c | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index f322f10f..93c32c5b 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -866,9 +866,11 @@ cli_resize(void *v, char **reply, int *len, void *data)
char * mapname = get_keyparam(v, MAP);
struct multipath *mpp;
int minor;
- unsigned long long size;
+ unsigned long long size = 0;
struct pathgroup *pgp;
struct path *pp;
+ unsigned int i, j;
+ bool mismatch = false;
mapname = convert_dev(mapname, 0);
condlog(2, "%s: resize map (operator)", mapname);
@@ -888,21 +890,24 @@ cli_resize(void *v, char **reply, int *len, void *data)
return 1;
}
- pgp = VECTOR_SLOT(mpp->pg, 0);
-
- if (!pgp){
- condlog(0, "%s: couldn't get path group. cannot resize",
- mapname);
- return 1;
+ vector_foreach_slot(mpp->pg, pgp, i) {
+ vector_foreach_slot (pgp->paths, pp, j) {
+ sysfs_get_size(pp, &pp->size);
+ if (!pp->size)
+ continue;
+ if (!size)
+ size = pp->size;
+ else if (pp->size != size)
+ mismatch = true;
+ }
}
- pp = VECTOR_SLOT(pgp->paths, 0);
-
- if (!pp){
- condlog(0, "%s: couldn't get path. cannot resize", mapname);
+ if (!size) {
+ condlog(0, "%s: couldn't get size from sysfs. cannot resize",
+ mapname);
return 1;
}
- if (!pp->udev || sysfs_get_size(pp, &size)) {
- condlog(0, "%s: couldn't get size for sysfs. cannot resize",
+ if (mismatch) {
+ condlog(0, "%s: path size not consistent. cannot resize",
mapname);
return 1;
}

View File

@ -0,0 +1,58 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 9 Nov 2023 18:46:14 -0500
Subject: [PATCH] multipathd: move post-reloading commands into resize_map()
In preparation for reusing resize_map() in other code, move all code
necessary to resize the map to the resize_map() function. Also track if
map was removed in the function.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli_handlers.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 93c32c5b..b08b248f 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -856,6 +856,10 @@ int resize_map(struct multipath *mpp, unsigned long long size,
mpp->size = orig_size;
return 1;
}
+ if (setup_multipath(vecs, mpp) != 0)
+ return 2;
+ sync_map_state(mpp);
+
return 0;
}
@@ -869,7 +873,7 @@ cli_resize(void *v, char **reply, int *len, void *data)
unsigned long long size = 0;
struct pathgroup *pgp;
struct path *pp;
- unsigned int i, j;
+ unsigned int i, j, ret;
bool mismatch = false;
mapname = convert_dev(mapname, 0);
@@ -919,14 +923,12 @@ cli_resize(void *v, char **reply, int *len, void *data)
condlog(3, "%s old size is %llu, new size is %llu", mapname, mpp->size,
size);
- if (resize_map(mpp, size, vecs) != 0)
- return 1;
+ ret = resize_map(mpp, size, vecs);
- if (setup_multipath(vecs, mpp) != 0)
- return 1;
- sync_map_state(mpp);
+ if (ret == 2)
+ condlog(0, "%s: map removed while trying to resize", mapname);
- return 0;
+ return (ret != 0);
}
int

View File

@ -0,0 +1,106 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 10 Nov 2023 17:59:42 -0500
Subject: [PATCH] multipathd: move resize_map() to multipathd/main.c
No functional changes.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli_handlers.c | 29 -----------------------------
multipathd/main.c | 29 +++++++++++++++++++++++++++++
multipathd/main.h | 2 ++
3 files changed, 31 insertions(+), 29 deletions(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index b08b248f..53bebc8d 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -834,35 +834,6 @@ cli_reload(void *v, char **reply, int *len, void *data)
return reload_and_sync_map(mpp, vecs, 0);
}
-int resize_map(struct multipath *mpp, unsigned long long size,
- struct vectors * vecs)
-{
- char *params __attribute__((cleanup(cleanup_charp))) = NULL;
- unsigned long long orig_size = mpp->size;
-
- mpp->size = size;
- update_mpp_paths(mpp, vecs->pathvec);
- if (setup_map(mpp, &params, vecs) != 0) {
- condlog(0, "%s: failed to setup map for resize : %s",
- mpp->alias, strerror(errno));
- mpp->size = orig_size;
- return 1;
- }
- mpp->action = ACT_RESIZE;
- mpp->force_udev_reload = 1;
- if (domap(mpp, params, 1) == DOMAP_FAIL) {
- condlog(0, "%s: failed to resize map : %s", mpp->alias,
- strerror(errno));
- mpp->size = orig_size;
- return 1;
- }
- if (setup_multipath(vecs, mpp) != 0)
- return 2;
- sync_map_state(mpp);
-
- return 0;
-}
-
int
cli_resize(void *v, char **reply, int *len, void *data)
{
diff --git a/multipathd/main.c b/multipathd/main.c
index 075e7b13..d99cad72 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1379,6 +1379,35 @@ needs_ro_update(struct multipath *mpp, int ro)
return true;
}
+int resize_map(struct multipath *mpp, unsigned long long size,
+ struct vectors * vecs)
+{
+ char *params __attribute__((cleanup(cleanup_charp))) = NULL;
+ unsigned long long orig_size = mpp->size;
+
+ mpp->size = size;
+ update_mpp_paths(mpp, vecs->pathvec);
+ if (setup_map(mpp, &params, vecs) != 0) {
+ condlog(0, "%s: failed to setup map for resize : %s",
+ mpp->alias, strerror(errno));
+ mpp->size = orig_size;
+ return 1;
+ }
+ mpp->action = ACT_RESIZE;
+ mpp->force_udev_reload = 1;
+ if (domap(mpp, params, 1) == DOMAP_FAIL) {
+ condlog(0, "%s: failed to resize map : %s", mpp->alias,
+ strerror(errno));
+ mpp->size = orig_size;
+ return 1;
+ }
+ if (setup_multipath(vecs, mpp) != 0)
+ return 2;
+ sync_map_state(mpp);
+
+ return 0;
+}
+
static int
uev_update_path (struct uevent *uev, struct vectors * vecs)
{
diff --git a/multipathd/main.h b/multipathd/main.h
index bc1f938f..dbae4935 100644
--- a/multipathd/main.h
+++ b/multipathd/main.h
@@ -66,4 +66,6 @@ int reload_and_sync_map(struct multipath *mpp, struct vectors *vecs,
void handle_path_wwid_change(struct path *pp, struct vectors *vecs);
bool check_path_wwid_change(struct path *pp);
+int resize_map(struct multipath *mpp, unsigned long long size,
+ struct vectors *vecs);
#endif /* MAIN_H */

Some files were not shown because too many files have changed in this diff Show More