update to 0.8.4

This commit is contained in:
lixiaokeng 2020-07-16 18:51:36 +08:00
parent 0db0e6cd35
commit c9a00d3ee1
64 changed files with 292 additions and 3214 deletions

View File

@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 1 Jun 2018 16:30:44 -0500
Subject: [PATCH] libmultipath: remove last of rbd code
My previous patch to remove the rbd code missed a little bit.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
kpartx/del-part-nodes.rules | 2 +-
libmultipath/structs.h | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/kpartx/del-part-nodes.rules b/kpartx/del-part-nodes.rules
index 17bc505..0ceecf5 100644
--- a/kpartx/del-part-nodes.rules
+++ b/kpartx/del-part-nodes.rules
@@ -10,7 +10,7 @@
# or create an udev rule file that sets ENV{DONT_DEL_PART_NODES}="1".
SUBSYSTEM!="block", GOTO="end_del_part_nodes"
-KERNEL!="sd*|dasd*|rbd*", GOTO="end_del_part_nodes"
+KERNEL!="sd*|dasd*", GOTO="end_del_part_nodes"
ACTION!="add|change", GOTO="end_del_part_nodes"
ENV{DEVTYPE}=="partition", GOTO="end_del_part_nodes"
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index e5b698b..ca14315 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -61,7 +61,6 @@ enum sysfs_buses {
SYSFS_BUS_IDE,
SYSFS_BUS_CCW,
SYSFS_BUS_CCISS,
- SYSFS_BUS_RBD,
SYSFS_BUS_NVME,
};
--
2.7.4

View File

@ -1,35 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 8 Jun 2018 17:12:37 -0500
Subject: [PATCH] libmultipath: fix detect alua corner case
If retain_attach_hw_handler = no, then the paths tpgs state will never
be checked, and the multipath device will always select the alua
handler, if no other handler is selected. the paths tpgs state
should be checked, regardless of the retain_hwhandler value.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/propsel.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index af3ed62..fdb5953 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -420,9 +420,11 @@ int select_hwhandler(struct config *conf, struct multipath *mp)
bool all_tpgs = true;
dh_state = &handler[2];
+
+ vector_foreach_slot(mp->paths, pp, i)
+ all_tpgs = all_tpgs && (pp->tpgs > 0);
if (mp->retain_hwhandler != RETAIN_HWHANDLER_OFF) {
vector_foreach_slot(mp->paths, pp, i) {
- all_tpgs = all_tpgs && (pp->tpgs > 0);
if (get_dh_state(pp, dh_state, sizeof(handler) - 2) > 0
&& strcmp(dh_state, "detached")) {
memcpy(handler, "1 ", 2);
--
2.7.4

View File

@ -0,0 +1,30 @@
From 48f537b9fef4f9db761466b8951fb63243f06602 Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Wed, 6 May 2020 09:35:47 +0200
Subject: [PATCH] libmpathpersist: depend on libmultipath
Without this the build fails with:
/usr/bin/ld: cannot find -lmultipath
Signed-off-by: Christian Hesse <mail@eworm.de>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 1dee368..ba1d73b 100644
--- a/Makefile
+++ b/Makefile
@@ -28,7 +28,7 @@ all: $(BUILDDIRS)
$(BUILDDIRS):
$(MAKE) -C $@
-multipath multipathd mpathpersist: libmultipath
+libmpathpersist multipath multipathd mpathpersist: libmultipath
mpathpersist: libmpathpersist
$(BUILDDIRS.clean):
--
1.8.3.1

View File

@ -1,39 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 8 Jun 2018 17:23:07 -0500
Subject: [PATCH] multipath: fix setting conf->version
Commit d3b71498 stopped multipath from setting conf->version. Instead,
it was always being set to 0.0.0. Multipathd was still setting this
correctly.
Fixes: d3b71498 "multipath: fix rcu thread cancellation hang"
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/devmapper.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
index f2befad..8136d15 100644
--- a/libmultipath/devmapper.c
+++ b/libmultipath/devmapper.c
@@ -245,13 +245,13 @@ void libmp_dm_init(void)
int verbosity;
unsigned int version[3];
+ if (dm_prereq(version))
+ exit(1);
conf = get_multipath_config();
verbosity = conf->verbosity;
- memcpy(version, conf->version, sizeof(version));
+ memcpy(conf->version, version, sizeof(version));
put_multipath_config(conf);
dm_init(verbosity);
- if (dm_prereq(version))
- exit(1);
dm_udev_set_sync_support(libmp_dm_udev_sync);
}
--
2.7.4

View File

@ -0,0 +1,42 @@
From 62bb0b61704e84e782edb2d8341060992152f25e Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 25 Mar 2020 23:22:46 -0500
Subject: [PATCH] libmultipath: assign variable to make gcc happy
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There is nothing wrong with is_queueing not being set at the start
of __set_no_path_retry(), it will always get set before it is accessed,
but gcc 8.2.1 is failing with
structs_vec.c: In function __set_no_path_retry:
structs_vec.c:339:7: error: is_queueing may be used uninitialized in
this function [-Werror=maybe-uninitialized]
bool is_queueing;
^~~~~~~~~~~
so, assign a value to make it happy.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs_vec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 3dbbaa0..077f2e4 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -336,7 +336,7 @@ static void leave_recovery_mode(struct multipath *mpp)
void __set_no_path_retry(struct multipath *mpp, bool check_features)
{
- bool is_queueing;
+ bool is_queueing = false; /* assign a value to make gcc happy */
check_features = check_features && mpp->features != NULL;
if (check_features)
--
1.8.3.1

View File

@ -1,152 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 26 Jun 2018 16:30:11 -0500
Subject: [PATCH] mpathpersist: add --param-alltgpt option
From the limited testing I've been able to do, commit 5b54e772
"mpathpersist: add all_tg_pt option", does appear to enable
--param-alltgpt to work correctly on devices that accept the ALL_TG_PT
flag, so I've added the option to mpathpersist.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmpathpersist/mpath_persist.c | 10 ++++------
mpathpersist/main.c | 11 ++++++++---
mpathpersist/main.h | 1 +
mpathpersist/mpathpersist.8 | 4 ++++
multipath/multipath.conf.5 | 8 +++++---
5 files changed, 22 insertions(+), 12 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 6e9e67f..61818e0 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -466,11 +466,14 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
int rc;
int count=0;
int status = MPATH_PR_SUCCESS;
+ int all_tg_pt;
uint64_t sa_key = 0;
if (!mpp)
return MPATH_PR_DMMP_ERROR;
+ all_tg_pt = (mpp->all_tg_pt == ALL_TG_PT_ON ||
+ paramp->sa_flags & MPATH_F_ALL_TG_PT_MASK);
active_pathcount = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST);
if (active_pathcount == 0) {
@@ -478,10 +481,6 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
return MPATH_PR_DMMP_ERROR;
}
- if ( paramp->sa_flags & MPATH_F_ALL_TG_PT_MASK ) {
- condlog (1, "Warning: ALL_TG_PT is set. Configuration not supported");
- }
-
struct threadinfo thread[active_pathcount];
int hosts[active_pathcount];
@@ -518,8 +517,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
condlog (1, "%s: %s path not up. Skip.", mpp->wwid, pp->dev);
continue;
}
- if (mpp->all_tg_pt == ALL_TG_PT_ON &&
- pp->sg_id.host_no != -1) {
+ if (all_tg_pt && pp->sg_id.host_no != -1) {
for (k = 0; k < count; k++) {
if (pp->sg_id.host_no == hosts[k]) {
condlog(3, "%s: %s host %d matches skip.", pp->wwid, pp->dev, pp->sg_id.host_no);
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 5b37f3a..99151fe 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -118,7 +118,7 @@ int main (int argc, char * argv[])
{
int option_index = 0;
- c = getopt_long (argc, argv, "v:Cd:hHioZK:S:PAT:skrGILcRX:l:",
+ c = getopt_long (argc, argv, "v:Cd:hHioYZK:S:PAT:skrGILcRX:l:",
long_options, &option_index);
if (c == -1)
break;
@@ -158,6 +158,10 @@ int main (int argc, char * argv[])
prout_flag = 1;
break;
+ case 'Y':
+ param_alltgpt = 1;
+ ++num_prout_param;
+ break;
case 'Z':
param_aptpl = 1;
++num_prout_param;
@@ -443,9 +447,9 @@ int main (int argc, char * argv[])
}
if (param_alltgpt)
- paramp->sa_flags |= 0x4;
+ paramp->sa_flags |= MPATH_F_ALL_TG_PT_MASK;
if (param_aptpl)
- paramp->sa_flags |= 0x1;
+ paramp->sa_flags |= MPATH_F_APTPL_MASK;
if (num_transport)
{
@@ -698,6 +702,7 @@ static void usage(void)
" --hex|-H output response in hex\n"
" --in|-i request PR In command \n"
" --out|-o request PR Out command\n"
+ " --param-alltgpt|-Y PR Out parameter 'ALL_TG_PT\n"
" --param-aptpl|-Z PR Out parameter 'APTPL'\n"
" --read-keys|-k PR In: Read Keys\n"
" --param-sark=SARK|-S SARK PR Out parameter service "
diff --git a/mpathpersist/main.h b/mpathpersist/main.h
index 5c0e089..beb8a21 100644
--- a/mpathpersist/main.h
+++ b/mpathpersist/main.h
@@ -6,6 +6,7 @@ static struct option long_options[] = {
{"hex", 0, NULL, 'H'},
{"in", 0, NULL, 'i'},
{"out", 0, NULL, 'o'},
+ {"param-alltgpt", 0, NULL, 'Y'},
{"param-aptpl", 0, NULL, 'Z'},
{"param-rk", 1, NULL, 'K'},
{"param-sark", 1, NULL, 'S'},
diff --git a/mpathpersist/mpathpersist.8 b/mpathpersist/mpathpersist.8
index a8982e6..885491d 100644
--- a/mpathpersist/mpathpersist.8
+++ b/mpathpersist/mpathpersist.8
@@ -87,6 +87,10 @@ Request PR In command.
Request PR Out command.
.
.TP
+.B \--param-alltgpt|\-Y
+PR Out parameter 'ALL_TG_PT'.
+.
+.TP
.B \--param-aptpl|\-Z
PR Out parameter 'APTPL'.
.
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index e4b25a0..fb863fd 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -756,9 +756,11 @@ The default is: \fB<unset>\fR
.
.TP
.B all_tg_pt
-This must be set to \fByes\fR to successfully use mpathpersist on arrays that
-automatically set and clear registration keys on all target ports from a
-host, instead of per target port per host.
+Set the 'all targets ports' flag when registering keys with mpathpersist. Some
+arrays automatically set and clear registration keys on all target ports from a
+host, instead of per target port per host. The ALL_TG_PT flag must be set to
+successfully use mpathpersist on these arrays. Setting this option is identical
+to calling mpathpersist with \fI--param-alltgpt\fR
.RS
.TP
The default is: \fBno\fR
--
2.7.4

View File

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 26 Jun 2018 16:45:48 -0500
Subject: [PATCH] libmutipath: remove unused IDE bus type
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index ca14315..0a2623a 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -58,7 +58,6 @@ enum failback_mode {
enum sysfs_buses {
SYSFS_BUS_UNDEF,
SYSFS_BUS_SCSI,
- SYSFS_BUS_IDE,
SYSFS_BUS_CCW,
SYSFS_BUS_CCISS,
SYSFS_BUS_NVME,
--
2.7.4

View File

@ -1,4 +1,4 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From e6ed042c280b0e40185490a9a69cccbcdf75bbf4 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com> From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 2 Jul 2014 12:49:53 -0500 Date: Wed, 2 Jul 2014 12:49:53 -0500
Subject: [PATCH] RH: Remove the property blacklist exception builtin Subject: [PATCH] RH: Remove the property blacklist exception builtin
@ -14,11 +14,11 @@ it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
--- ---
libmultipath/blacklist.c | 12 ++++-------- libmultipath/blacklist.c | 12 ++++--------
multipath/multipath.conf.5 | 14 ++++++-------- multipath/multipath.conf.5 | 12 ++++++------
2 files changed, 10 insertions(+), 16 deletions(-) 2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
index 318ec03..c0cfbca 100644 index 00e8dbd..a8e0311 100644
--- a/libmultipath/blacklist.c --- a/libmultipath/blacklist.c
+++ b/libmultipath/blacklist.c +++ b/libmultipath/blacklist.c
@@ -204,12 +204,6 @@ setup_default_blist (struct config * conf) @@ -204,12 +204,6 @@ setup_default_blist (struct config * conf)
@ -34,14 +34,20 @@ index 318ec03..c0cfbca 100644
vector_foreach_slot (conf->hwtable, hwe, i) { vector_foreach_slot (conf->hwtable, hwe, i) {
if (hwe->bl_product) { if (hwe->bl_product) {
if (find_blacklist_device(conf->blist_device, if (find_blacklist_device(conf->blist_device,
@@ -394,9 +388,11 @@ filter_property(struct config * conf, struct udev_device * udev) @@ -395,7 +389,8 @@ filter_property(struct config *conf, struct udev_device *udev, int lvl,
if (udev) { if (udev) {
/* /*
* This is the inverse of the 'normal' matching; * This is the inverse of the 'normal' matching;
- * the environment variable _has_ to match. - * the environment variable _has_ to match.
+ * the environment variable _has_ to match + * the environment variable _has_ to match
+ * if a whitelist is present. + * if a whitelist is present.
*/ * But only if the uid_attribute used for determining the WWID
* of the path is is present in the environment
* (uid_attr_seen). If this is not the case, udev probably
@@ -411,7 +406,8 @@ filter_property(struct config *conf, struct udev_device *udev, int lvl,
*uid_attribute != '\0';
bool uid_attr_seen = false;
- r = MATCH_PROPERTY_BLIST_MISSING; - r = MATCH_PROPERTY_BLIST_MISSING;
+ if (VECTOR_SIZE(conf->elist_property)) + if (VECTOR_SIZE(conf->elist_property))
+ r = MATCH_PROPERTY_BLIST_MISSING; + r = MATCH_PROPERTY_BLIST_MISSING;
@ -49,10 +55,10 @@ index 318ec03..c0cfbca 100644
udev_device_get_properties_list_entry(udev)) { udev_device_get_properties_list_entry(udev)) {
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index 6333366..3dab26b 100644 index 05a5e8f..2f2d8cc 100644
--- a/multipath/multipath.conf.5 --- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5
@@ -1195,16 +1195,14 @@ keywords. Both are regular expressions. For a full description of these keywords @@ -1286,7 +1286,8 @@ keywords. Both are regular expressions. For a full description of these keywords
Regular expression for an udev property. All Regular expression for an udev property. All
devices that have matching udev properties will be excluded/included. devices that have matching udev properties will be excluded/included.
The handling of the \fIproperty\fR keyword is special, The handling of the \fIproperty\fR keyword is special,
@ -61,8 +67,11 @@ index 6333366..3dab26b 100644
+least one whitelisted udev property; +least one whitelisted udev property;
otherwise they're treated as blacklisted, and the message otherwise they're treated as blacklisted, and the message
"\fIblacklisted, udev property missing\fR" is displayed in the logs. "\fIblacklisted, udev property missing\fR" is displayed in the logs.
-. .
-.RS @@ -1299,11 +1300,10 @@ 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.
-.PP -.PP
-The default \fIblacklist exception\fR is: \fB(SCSI_IDENT_|ID_WWN)\fR, causing -The default \fIblacklist exception\fR is: \fB(SCSI_IDENT_|ID_WWN)\fR, causing
-well-behaved SCSI devices and devices that provide a WWN (World Wide Number) -well-behaved SCSI devices and devices that provide a WWN (World Wide Number)
@ -76,5 +85,5 @@ index 6333366..3dab26b 100644
.B protocol .B protocol
Regular expression for the protocol of a device to be excluded/included. Regular expression for the protocol of a device to be excluded/included.
-- --
2.7.4 1.8.3.1

View File

@ -1,92 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 26 Jun 2018 17:04:57 -0500
Subject: [PATCH] multipathd: add new protocol path wildcard
This patch adds a new path wildcard 'P', that will print the path's
protocol. For scsi devices, it will additionally print the transport
protocol being used.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/print.c | 43 +++++++++++++++++++++++++++++++++++++++++++
libmultipath/print.h | 2 ++
2 files changed, 45 insertions(+)
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 222d270..ecfcb48 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -638,6 +638,48 @@ snprint_path_failures(char * buff, size_t len, const struct path * pp)
return snprint_int(buff, len, pp->failcount);
}
+/* if you add a protocol string bigger than "scsi:unspec" you must
+ * also change PROTOCOL_BUF_SIZE */
+int
+snprint_path_protocol(char * buff, size_t len, 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");
+ case SCSI_PROTOCOL_SPI:
+ return snprintf(buff, len, "scsi:spi");
+ case SCSI_PROTOCOL_SSA:
+ return snprintf(buff, len, "scsi:ssa");
+ case SCSI_PROTOCOL_SBP:
+ return snprintf(buff, len, "scsi:sbp");
+ case SCSI_PROTOCOL_SRP:
+ return snprintf(buff, len, "scsi:srp");
+ case SCSI_PROTOCOL_ISCSI:
+ return snprintf(buff, len, "scsi:iscsi");
+ case SCSI_PROTOCOL_SAS:
+ return snprintf(buff, len, "scsi:sas");
+ case SCSI_PROTOCOL_ADT:
+ return snprintf(buff, len, "scsi:adt");
+ case SCSI_PROTOCOL_ATA:
+ return snprintf(buff, len, "scsi:ata");
+ case SCSI_PROTOCOL_UNSPEC:
+ default:
+ return snprintf(buff, len, "scsi:unspec");
+ }
+ case SYSFS_BUS_CCW:
+ return snprintf(buff, len, "ccw");
+ case SYSFS_BUS_CCISS:
+ return snprintf(buff, len, "cciss");
+ case SYSFS_BUS_NVME:
+ return snprintf(buff, len, "nvme");
+ case SYSFS_BUS_UNDEF:
+ default:
+ return snprintf(buff, len, "undef");
+ }
+}
+
struct multipath_data mpd[] = {
{'n', "name", 0, snprint_name},
{'w', "uuid", 0, snprint_multipath_uuid},
@@ -687,6 +729,7 @@ struct path_data pd[] = {
{'a', "host adapter", 0, snprint_host_adapter},
{'G', "foreign", 0, snprint_path_foreign},
{'0', "failures", 0, snprint_path_failures},
+ {'P', "protocol", 0, snprint_path_protocol},
{0, NULL, 0 , NULL}
};
diff --git a/libmultipath/print.h b/libmultipath/print.h
index 608b7d5..e2fb865 100644
--- a/libmultipath/print.h
+++ b/libmultipath/print.h
@@ -133,6 +133,8 @@ int snprint_host_wwnn (char *, size_t, const struct path *);
int snprint_host_wwpn (char *, size_t, const struct path *);
int snprint_tgt_wwnn (char *, size_t, const struct path *);
int snprint_tgt_wwpn (char *, size_t, const struct path *);
+#define PROTOCOL_BUF_SIZE sizeof("scsi:unspec")
+int snprint_path_protocol(char *, size_t, const struct path *);
void _print_multipath_topology (const struct gen_multipath * gmp,
int verbosity);
--
2.7.4

View File

@ -8,18 +8,18 @@ Subject: [PATCH] fix syntax error
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc diff --git a/Makefile.inc b/Makefile.inc
index 5ff69a3..3744aa4 100644 index d4d1e0d..158e7b6 100644
--- a/Makefile.inc --- a/Makefile.inc
+++ b/Makefile.inc +++ b/Makefile.inc
@@ -40,7 +40,7 @@ endif @@ -41,7 +41,7 @@ ifndef SYSTEMD
else
ifndef SYSTEMD ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
ifeq ($(shell systemctl --version > /dev/null 2>&1 && echo 1), 1) SYSTEMD = $(shell systemctl --version 2> /dev/null | \
- SYSTEMD = $(shell systemctl --version 2> /dev/null | sed -n 's/systemd \([0-9]*\)/\1/p') - sed -n 's/systemd \([0-9]*\).*/\1/p')
+ SYSTEMD = $(shell systemctl --version 2> /dev/null | sed -n 's/systemd\([0-9]*\)/\1/p' | awk '{print $$1}') + sed -n 's/systemd\([0-9]*\).*/\1/p' | awk '{print $$1}')
endif
endif endif
endif endif
-- --
2.19.1 1.8.3.1

View File

@ -1,425 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 28 Jun 2018 13:16:11 -0500
Subject: [PATCH] libmultipath: add "protocol" blacklist option.
Multiple users have requested an easy way to setup blacklists that do
things such as blacklisting all non FC and iSCSI devices. Currently
there is no easy way to do this, without knowing in advance what the
devices are. Looking into the udev property values, I didn't see a
consistent set of values that would worked for all the different types
of requests like this (which would have allowed us to solve this by
extending the "property" blacklist option to allow comparing values,
instead of just keywords).
Instead I've opted to allow multipath to blacklist/whitelist devices
by the protocol strings printed by "multipathd: add new protocol path
wildcard". This check happens after multipath checks the "device"
keyword, and before it checks wwid. This gives users an easily
understandible method to set up these types of blacklists, without
needing to know the exact arrays being used.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/blacklist.c | 51 ++++++++++++++++++++++++++++++++++++++--------
libmultipath/blacklist.h | 3 +++
libmultipath/config.c | 15 ++++++++++++++
libmultipath/config.h | 2 ++
libmultipath/dict.c | 14 +++++++++++--
libmultipath/discovery.c | 5 +++--
libmultipath/print.c | 31 ++++++++++++++++++++++++++++
multipath/multipath.conf.5 | 16 +++++++++++++--
8 files changed, 123 insertions(+), 14 deletions(-)
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
index 361c603..fdd36f7 100644
--- a/libmultipath/blacklist.c
+++ b/libmultipath/blacklist.c
@@ -12,6 +12,8 @@
#include "structs.h"
#include "config.h"
#include "blacklist.h"
+#include "structs_vec.h"
+#include "print.h"
int store_ble(vector blist, char * str, int origin)
{
@@ -240,12 +242,14 @@ setup_default_blist (struct config * conf)
condlog(3, "%s: %s %s %s", dev, (M), wwid, (S)); \
else if (env) \
condlog(3, "%s: %s %s %s", dev, (M), env, (S)); \
+ else if (protocol) \
+ condlog(3, "%s: %s %s %s", dev, (M), protocol, (S)); \
else \
condlog(3, "%s: %s %s", dev, (M), (S))
void
log_filter (const char *dev, char *vendor, char *product, char *wwid,
- const char *env, int r)
+ const char *env, const char *protocol, int r)
{
/*
* Try to sort from most likely to least.
@@ -265,6 +269,9 @@ log_filter (const char *dev, char *vendor, char *product, char *wwid,
case MATCH_PROPERTY_BLIST:
LOG_BLIST("udev property", "blacklisted");
break;
+ case MATCH_PROTOCOL_BLIST:
+ LOG_BLIST("protocol", "blacklisted");
+ break;
case MATCH_DEVICE_BLIST_EXCEPT:
LOG_BLIST("vendor/product", "whitelisted");
break;
@@ -280,6 +287,9 @@ log_filter (const char *dev, char *vendor, char *product, char *wwid,
case MATCH_PROPERTY_BLIST_MISSING:
LOG_BLIST("blacklisted,", "udev property missing");
break;
+ case MATCH_PROTOCOL_BLIST_EXCEPT:
+ LOG_BLIST("protocol", "whitelisted");
+ break;
}
}
@@ -299,7 +309,7 @@ int
filter_device (vector blist, vector elist, char * vendor, char * product)
{
int r = _filter_device(blist, elist, vendor, product);
- log_filter(NULL, vendor, product, NULL, NULL, r);
+ log_filter(NULL, vendor, product, NULL, NULL, NULL, r);
return r;
}
@@ -319,7 +329,7 @@ int
filter_devnode (vector blist, vector elist, char * dev)
{
int r = _filter_devnode(blist, elist, dev);
- log_filter(dev, NULL, NULL, NULL, NULL, r);
+ log_filter(dev, NULL, NULL, NULL, NULL, NULL, r);
return r;
}
@@ -339,7 +349,29 @@ int
filter_wwid (vector blist, vector elist, char * wwid, char * dev)
{
int r = _filter_wwid(blist, elist, wwid);
- log_filter(dev, NULL, NULL, wwid, NULL, r);
+ log_filter(dev, NULL, NULL, wwid, NULL, NULL, r);
+ return r;
+}
+
+static int
+_filter_protocol (vector blist, vector elist, const char * protocol_str)
+{
+ if (_blacklist_exceptions(elist, protocol_str))
+ return MATCH_PROTOCOL_BLIST_EXCEPT;
+ if (_blacklist(blist, protocol_str))
+ return MATCH_PROTOCOL_BLIST;
+ return 0;
+}
+
+int
+filter_protocol(vector blist, vector elist, struct path * pp)
+{
+ char buf[PROTOCOL_BUF_SIZE];
+ int r;
+
+ snprint_path_protocol(buf, sizeof(buf), pp);
+ r = _filter_protocol(blist, elist, buf);
+ log_filter(pp->dev, NULL, NULL, NULL, NULL, buf, r);
return r;
}
@@ -351,7 +383,6 @@ _filter_path (struct config * conf, struct path * pp)
r = filter_property(conf, pp->udev);
if (r > 0)
return r;
-
r = _filter_devnode(conf->blist_devnode, conf->elist_devnode,pp->dev);
if (r > 0)
return r;
@@ -359,6 +390,9 @@ _filter_path (struct config * conf, struct path * pp)
pp->vendor_id, pp->product_id);
if (r > 0)
return r;
+ r = filter_protocol(conf->blist_protocol, conf->elist_protocol, pp);
+ if (r > 0)
+ return r;
r = _filter_wwid(conf->blist_wwid, conf->elist_wwid, pp->wwid);
return r;
}
@@ -367,7 +401,8 @@ int
filter_path (struct config * conf, struct path * pp)
{
int r=_filter_path(conf, pp);
- log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL, r);
+ log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL,
+ NULL, r);
return r;
}
@@ -402,7 +437,7 @@ filter_property(struct config * conf, struct udev_device * udev)
r = _filter_property(conf, env);
if (r) {
- log_filter(devname, NULL, NULL, NULL, env, r);
+ log_filter(devname, NULL, NULL, NULL, env, NULL, r);
return r;
}
}
@@ -411,7 +446,7 @@ filter_property(struct config * conf, struct udev_device * udev)
* This is the inverse of the 'normal' matching;
* the environment variable _has_ to match.
*/
- log_filter(devname, NULL, NULL, NULL, NULL,
+ log_filter(devname, NULL, NULL, NULL, NULL, NULL,
MATCH_PROPERTY_BLIST_MISSING);
return MATCH_PROPERTY_BLIST_MISSING;
}
diff --git a/libmultipath/blacklist.h b/libmultipath/blacklist.h
index 0b028d4..f7beef2 100644
--- a/libmultipath/blacklist.h
+++ b/libmultipath/blacklist.h
@@ -10,10 +10,12 @@
#define MATCH_DEVNODE_BLIST 3
#define MATCH_PROPERTY_BLIST 4
#define MATCH_PROPERTY_BLIST_MISSING 5
+#define MATCH_PROTOCOL_BLIST 6
#define MATCH_WWID_BLIST_EXCEPT -MATCH_WWID_BLIST
#define MATCH_DEVICE_BLIST_EXCEPT -MATCH_DEVICE_BLIST
#define MATCH_DEVNODE_BLIST_EXCEPT -MATCH_DEVNODE_BLIST
#define MATCH_PROPERTY_BLIST_EXCEPT -MATCH_PROPERTY_BLIST
+#define MATCH_PROTOCOL_BLIST_EXCEPT -MATCH_PROTOCOL_BLIST
struct blentry {
char * str;
@@ -36,6 +38,7 @@ int filter_wwid (vector, vector, char *, char *);
int filter_device (vector, vector, char *, char *);
int filter_path (struct config *, struct path *);
int filter_property(struct config *, struct udev_device *);
+int filter_protocol(vector, vector, struct path *);
int store_ble (vector, char *, int);
int set_ble_device (vector, char *, char *, int);
void free_blacklist (vector);
diff --git a/libmultipath/config.c b/libmultipath/config.c
index afa309d..0aef186 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -623,11 +623,13 @@ free_config (struct config * conf)
free_blacklist(conf->blist_devnode);
free_blacklist(conf->blist_wwid);
free_blacklist(conf->blist_property);
+ free_blacklist(conf->blist_protocol);
free_blacklist_device(conf->blist_device);
free_blacklist(conf->elist_devnode);
free_blacklist(conf->elist_wwid);
free_blacklist(conf->elist_property);
+ free_blacklist(conf->elist_protocol);
free_blacklist_device(conf->elist_device);
free_mptable(conf->mptable);
@@ -780,6 +782,12 @@ load_config (char * file)
if (!conf->blist_property)
goto out;
}
+ if (conf->blist_protocol == NULL) {
+ conf->blist_protocol = vector_alloc();
+
+ if (!conf->blist_protocol)
+ goto out;
+ }
if (conf->elist_devnode == NULL) {
conf->elist_devnode = vector_alloc();
@@ -807,6 +815,13 @@ load_config (char * file)
if (!conf->elist_property)
goto out;
}
+ if (conf->elist_protocol == NULL) {
+ conf->elist_protocol = vector_alloc();
+
+ if (!conf->elist_protocol)
+ goto out;
+ }
+
if (setup_default_blist(conf))
goto out;
diff --git a/libmultipath/config.h b/libmultipath/config.h
index 6bd42f0..7d0cd9a 100644
--- a/libmultipath/config.h
+++ b/libmultipath/config.h
@@ -210,10 +210,12 @@ struct config {
vector blist_wwid;
vector blist_device;
vector blist_property;
+ vector blist_protocol;
vector elist_devnode;
vector elist_wwid;
vector elist_device;
vector elist_property;
+ vector elist_protocol;
};
extern struct udev * udev;
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 15e7582..32524d5 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -1291,9 +1291,12 @@ blacklist_handler(struct config *conf, vector strvec)
conf->blist_device = vector_alloc();
if (!conf->blist_property)
conf->blist_property = vector_alloc();
+ if (!conf->blist_protocol)
+ conf->blist_protocol = vector_alloc();
if (!conf->blist_devnode || !conf->blist_wwid ||
- !conf->blist_device || !conf->blist_property)
+ !conf->blist_device || !conf->blist_property ||
+ !conf->blist_protocol)
return 1;
return 0;
@@ -1310,9 +1313,12 @@ blacklist_exceptions_handler(struct config *conf, vector strvec)
conf->elist_device = vector_alloc();
if (!conf->elist_property)
conf->elist_property = vector_alloc();
+ if (!conf->elist_protocol)
+ conf->elist_protocol = vector_alloc();
if (!conf->elist_devnode || !conf->elist_wwid ||
- !conf->elist_device || !conf->elist_property)
+ !conf->elist_device || !conf->elist_property ||
+ !conf->elist_protocol)
return 1;
return 0;
@@ -1356,6 +1362,8 @@ declare_ble_handler(blist_wwid)
declare_ble_handler(elist_wwid)
declare_ble_handler(blist_property)
declare_ble_handler(elist_property)
+declare_ble_handler(blist_protocol)
+declare_ble_handler(elist_protocol)
static int
snprint_def_uxsock_timeout(struct config *conf, char * buff, int len,
@@ -1627,6 +1635,7 @@ init_keywords(vector keywords)
install_keyword_multi("devnode", &ble_blist_devnode_handler, &snprint_ble_simple);
install_keyword_multi("wwid", &ble_blist_wwid_handler, &snprint_ble_simple);
install_keyword_multi("property", &ble_blist_property_handler, &snprint_ble_simple);
+ install_keyword_multi("protocol", &ble_blist_protocol_handler, &snprint_ble_simple);
install_keyword_multi("device", &ble_device_handler, NULL);
install_sublevel();
install_keyword("vendor", &ble_blist_device_vendor_handler, &snprint_bled_vendor);
@@ -1636,6 +1645,7 @@ init_keywords(vector keywords)
install_keyword_multi("devnode", &ble_elist_devnode_handler, &snprint_ble_simple);
install_keyword_multi("wwid", &ble_elist_wwid_handler, &snprint_ble_simple);
install_keyword_multi("property", &ble_elist_property_handler, &snprint_ble_simple);
+ install_keyword_multi("protocol", &ble_elist_protocol_handler, &snprint_ble_simple);
install_keyword_multi("device", &ble_except_device_handler, NULL);
install_sublevel();
install_keyword("vendor", &ble_elist_device_vendor_handler, &snprint_bled_vendor);
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 573d98b..e58a3fa 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1887,9 +1887,10 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
if (mask & DI_BLACKLIST && mask & DI_SYSFS) {
if (filter_device(conf->blist_device, conf->elist_device,
- pp->vendor_id, pp->product_id) > 0) {
+ pp->vendor_id, pp->product_id) > 0 ||
+ filter_protocol(conf->blist_protocol, conf->elist_protocol,
+ pp) > 0)
return PATHINFO_SKIPPED;
- }
}
path_state = path_offline(pp);
diff --git a/libmultipath/print.c b/libmultipath/print.c
index ecfcb48..9da6a77 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -1688,6 +1688,19 @@ int snprint_blacklist_report(struct config *conf, char *buff, int len)
if ((len - fwd - threshold) <= 0)
return len;
+ fwd += snprintf(buff + fwd, len - fwd, "protocol rules:\n"
+ "- blacklist:\n");
+ if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_protocol))
+ return len;
+
+ if ((len - fwd - threshold) <= 0)
+ return len;
+ fwd += snprintf(buff + fwd, len - fwd, "- exceptions:\n");
+ if (snprint_blacklist_group(buff, len, &fwd, &conf->elist_protocol) == 0)
+ return len;
+
+ if ((len - fwd - threshold) <= 0)
+ return len;
fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n"
"- blacklist:\n");
if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0)
@@ -1761,6 +1774,15 @@ static int snprint_blacklist(const struct config *conf, char *buff, int len)
if (fwd >= len)
return len;
}
+ vector_foreach_slot (conf->blist_protocol, ble, i) {
+ kw = find_keyword(conf->keywords, rootkw->sub, "protocol");
+ if (!kw)
+ return 0;
+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n",
+ kw, ble);
+ if (fwd >= len)
+ return len;
+ }
rootkw = find_keyword(conf->keywords, rootkw->sub, "device");
if (!rootkw)
return 0;
@@ -1838,6 +1860,15 @@ static int snprint_blacklist_except(const struct config *conf,
if (fwd >= len)
return len;
}
+ vector_foreach_slot (conf->elist_protocol, ele, i) {
+ kw = find_keyword(conf->keywords, rootkw->sub, "protocol");
+ if (!kw)
+ return 0;
+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t%k %v\n",
+ kw, ele);
+ if (fwd >= len)
+ return len;
+ }
rootkw = find_keyword(conf->keywords, rootkw->sub, "device");
if (!rootkw)
return 0;
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index fb863fd..6333366 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1205,9 +1205,21 @@ The default \fIblacklist exception\fR is: \fB(SCSI_IDENT_|ID_WWN)\fR, causing
well-behaved SCSI devices and devices that provide a WWN (World Wide Number)
to be included, and all others to be excluded.
.RE
+.TP
+.B protocol
+Regular expression for the protocol of a device to be excluded/included.
+.RS
+.PP
+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,
+\fIscsi:unspec\fR, \fIccw\fR, \fIcciss\fR, \fInvme\fR, and \fIundef\fR.
+The protocol that a path is using can be viewed by running
+\fBmultipathd show paths format "%d %P"\fR
+.RE
.LP
-For every device, these 4 blacklist criteria are evaluated in the the order
-"property, dev\%node, device, wwid". If a device turns out to be
+For every device, these 5 blacklist criteria are evaluated in the the order
+"property, dev\%node, device, protocol, wwid". If a device turns out to be
blacklisted by any criterion, it's excluded from handling by multipathd, and
the later criteria aren't evaluated any more. For each
criterion, the whitelist takes precedence over the blacklist if a device
--
2.7.4

View File

@ -1,5 +1,5 @@
--- multipath-tools-130222-patched/multipathd/cli_handlers.c 2017-10-12 19:19:08.000000000 +0800 --- a/multipathd/cli_handlers.c
+++ multipath-tools-130222-patched1/multipathd/cli_handlers.c 2017-10-17 14:43:43.000000000 +0800 +++ b/multipathd/cli_handlers.c
@@ -593,9 +593,10 @@ @@ -593,9 +593,10 @@
char * mapname = get_keyparam(v, MAP); char * mapname = get_keyparam(v, MAP);
struct multipath *mpp; struct multipath *mpp;

View File

@ -1,296 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 3 Jul 2018 19:15:03 -0500
Subject: [PATCH] libmultipath: remove _filter_* blacklist functions
The one point of these functions was for _filter_path(), and that wasn't
improved by using them. Since filter_path() only printed one message at
the end, you could have situations where the wwid was blacklisted, but
the blacklist message included the vendor/product instead. Also, the
protocol and property messages were printed twice, and if the device was
on multiple whitelists, only the last one is printed.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/blacklist.c | 168 +++++++++++++++++++----------------------------
libmultipath/blacklist.h | 2 +-
libmultipath/configure.c | 2 +-
libmultipath/discovery.c | 2 +-
4 files changed, 71 insertions(+), 103 deletions(-)
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
index fdd36f7..318ec03 100644
--- a/libmultipath/blacklist.c
+++ b/libmultipath/blacklist.c
@@ -294,161 +294,129 @@ log_filter (const char *dev, char *vendor, char *product, char *wwid,
}
int
-_filter_device (vector blist, vector elist, char * vendor, char * product)
+filter_device (vector blist, vector elist, char * vendor, char * product,
+ char * dev)
{
- if (!vendor || !product)
- return 0;
- if (_blacklist_exceptions_device(elist, vendor, product))
- return MATCH_DEVICE_BLIST_EXCEPT;
- if (_blacklist_device(blist, vendor, product))
- return MATCH_DEVICE_BLIST;
- return 0;
-}
+ int r = MATCH_NOTHING;
-int
-filter_device (vector blist, vector elist, char * vendor, char * product)
-{
- int r = _filter_device(blist, elist, vendor, product);
- log_filter(NULL, vendor, product, NULL, NULL, NULL, r);
- return r;
-}
+ if (vendor && product) {
+ if (_blacklist_exceptions_device(elist, vendor, product))
+ r = MATCH_DEVICE_BLIST_EXCEPT;
+ else if (_blacklist_device(blist, vendor, product))
+ r = MATCH_DEVICE_BLIST;
+ }
-int
-_filter_devnode (vector blist, vector elist, char * dev)
-{
- if (!dev)
- return 0;
- if (_blacklist_exceptions(elist, dev))
- return MATCH_DEVNODE_BLIST_EXCEPT;
- if (_blacklist(blist, dev))
- return MATCH_DEVNODE_BLIST;
- return 0;
+ log_filter(dev, vendor, product, NULL, NULL, NULL, r);
+ return r;
}
int
filter_devnode (vector blist, vector elist, char * dev)
{
- int r = _filter_devnode(blist, elist, dev);
+ int r = MATCH_NOTHING;
+
+ if (dev) {
+ if (_blacklist_exceptions(elist, dev))
+ r = MATCH_DEVNODE_BLIST_EXCEPT;
+ else if (_blacklist(blist, dev))
+ r = MATCH_DEVNODE_BLIST;
+ }
+
log_filter(dev, NULL, NULL, NULL, NULL, NULL, r);
return r;
}
int
-_filter_wwid (vector blist, vector elist, char * wwid)
-{
- if (!wwid)
- return 0;
- if (_blacklist_exceptions(elist, wwid))
- return MATCH_WWID_BLIST_EXCEPT;
- if (_blacklist(blist, wwid))
- return MATCH_WWID_BLIST;
- return 0;
-}
-
-int
filter_wwid (vector blist, vector elist, char * wwid, char * dev)
{
- int r = _filter_wwid(blist, elist, wwid);
+ int r = MATCH_NOTHING;
+
+ if (wwid) {
+ if (_blacklist_exceptions(elist, wwid))
+ r = MATCH_WWID_BLIST_EXCEPT;
+ else if (_blacklist(blist, wwid))
+ r = MATCH_WWID_BLIST;
+ }
+
log_filter(dev, NULL, NULL, wwid, NULL, NULL, r);
return r;
}
-static int
-_filter_protocol (vector blist, vector elist, const char * protocol_str)
-{
- if (_blacklist_exceptions(elist, protocol_str))
- return MATCH_PROTOCOL_BLIST_EXCEPT;
- if (_blacklist(blist, protocol_str))
- return MATCH_PROTOCOL_BLIST;
- return 0;
-}
-
int
filter_protocol(vector blist, vector elist, struct path * pp)
{
char buf[PROTOCOL_BUF_SIZE];
- int r;
+ int r = MATCH_NOTHING;
+
+ if (pp) {
+ snprint_path_protocol(buf, sizeof(buf), pp);
+
+ if (_blacklist_exceptions(elist, buf))
+ r = MATCH_PROTOCOL_BLIST_EXCEPT;
+ else if (_blacklist(blist, buf))
+ r = MATCH_PROTOCOL_BLIST;
+ }
- snprint_path_protocol(buf, sizeof(buf), pp);
- r = _filter_protocol(blist, elist, buf);
log_filter(pp->dev, NULL, NULL, NULL, NULL, buf, r);
return r;
}
int
-_filter_path (struct config * conf, struct path * pp)
+filter_path (struct config * conf, struct path * pp)
{
int r;
r = filter_property(conf, pp->udev);
if (r > 0)
return r;
- r = _filter_devnode(conf->blist_devnode, conf->elist_devnode,pp->dev);
+ r = filter_devnode(conf->blist_devnode, conf->elist_devnode, pp->dev);
if (r > 0)
return r;
- r = _filter_device(conf->blist_device, conf->elist_device,
- pp->vendor_id, pp->product_id);
+ r = filter_device(conf->blist_device, conf->elist_device,
+ pp->vendor_id, pp->product_id, pp->dev);
if (r > 0)
return r;
r = filter_protocol(conf->blist_protocol, conf->elist_protocol, pp);
if (r > 0)
return r;
- r = _filter_wwid(conf->blist_wwid, conf->elist_wwid, pp->wwid);
+ r = filter_wwid(conf->blist_wwid, conf->elist_wwid, pp->wwid, pp->dev);
return r;
}
int
-filter_path (struct config * conf, struct path * pp)
-{
- int r=_filter_path(conf, pp);
- log_filter(pp->dev, pp->vendor_id, pp->product_id, pp->wwid, NULL,
- NULL, r);
- return r;
-}
-
-int
-_filter_property (struct config *conf, const char *env)
-{
- if (_blacklist_exceptions(conf->elist_property, env))
- return MATCH_PROPERTY_BLIST_EXCEPT;
- if (_blacklist(conf->blist_property, env))
- return MATCH_PROPERTY_BLIST;
-
- return 0;
-}
-
-int
filter_property(struct config * conf, struct udev_device * udev)
{
const char *devname = udev_device_get_sysname(udev);
struct udev_list_entry *list_entry;
- int r;
-
- if (!udev)
- return 0;
-
- udev_list_entry_foreach(list_entry,
+ const char *env = NULL;
+ int r = MATCH_NOTHING;
+
+ if (udev) {
+ /*
+ * This is the inverse of the 'normal' matching;
+ * the environment variable _has_ to match.
+ */
+ r = MATCH_PROPERTY_BLIST_MISSING;
+ udev_list_entry_foreach(list_entry,
udev_device_get_properties_list_entry(udev)) {
- const char *env;
-
- env = udev_list_entry_get_name(list_entry);
- if (!env)
- continue;
- r = _filter_property(conf, env);
- if (r) {
- log_filter(devname, NULL, NULL, NULL, env, NULL, r);
- return r;
+ env = udev_list_entry_get_name(list_entry);
+ if (!env)
+ continue;
+ if (_blacklist_exceptions(conf->elist_property, env)) {
+ r = MATCH_PROPERTY_BLIST_EXCEPT;
+ break;
+ }
+ if (_blacklist(conf->blist_property, env)) {
+ r = MATCH_PROPERTY_BLIST;
+ break;
+ }
+ env = NULL;
}
}
- /*
- * This is the inverse of the 'normal' matching;
- * the environment variable _has_ to match.
- */
- log_filter(devname, NULL, NULL, NULL, NULL, NULL,
- MATCH_PROPERTY_BLIST_MISSING);
- return MATCH_PROPERTY_BLIST_MISSING;
+ log_filter(devname, NULL, NULL, NULL, env, NULL, r);
+ return r;
}
static void free_ble(struct blentry *ble)
diff --git a/libmultipath/blacklist.h b/libmultipath/blacklist.h
index f7beef2..18903b6 100644
--- a/libmultipath/blacklist.h
+++ b/libmultipath/blacklist.h
@@ -35,7 +35,7 @@ int setup_default_blist (struct config *);
int alloc_ble_device (vector);
int filter_devnode (vector, vector, char *);
int filter_wwid (vector, vector, char *, char *);
-int filter_device (vector, vector, char *, char *);
+int filter_device (vector, vector, char *, char *, char *);
int filter_path (struct config *, struct path *);
int filter_property(struct config *, struct udev_device *);
int filter_protocol(vector, vector, struct path *);
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 5c54f9b..09c3dcf 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1030,7 +1030,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
invalid = 1;
pthread_cleanup_pop(1);
if (invalid) {
- orphan_path(pp1, "wwid blacklisted");
+ orphan_path(pp1, "blacklisted");
continue;
}
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index e58a3fa..0b1855d 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1887,7 +1887,7 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
if (mask & DI_BLACKLIST && mask & DI_SYSFS) {
if (filter_device(conf->blist_device, conf->elist_device,
- pp->vendor_id, pp->product_id) > 0 ||
+ pp->vendor_id, pp->product_id, pp->dev) > 0 ||
filter_protocol(conf->blist_protocol, conf->elist_protocol,
pp) > 0)
return PATHINFO_SKIPPED;
--
2.7.4

View File

@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 3 Jul 2018 19:59:33 -0500
Subject: [PATCH] multipath tests: change to work with old make versions
the $(file <) operation only works with make 4.2 and above. I tried
running the tests on an old machine and it failed. The $shell function
can do the same thing and multipath has been using that in its
Makefiles for a while.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
tests/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/Makefile b/tests/Makefile
index 78755ed..d293c87 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -51,4 +51,4 @@ COLON:=:
$(multipathdir)/libmultipath.so Makefile
$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $< $($@_TESTDEPS) $($@_OBJDEPS) \
$(LIBDEPS) $($@_LIBDEPS) \
- $(file <$<.wrap) $(foreach dep,$($@_TESTDEPS),$(file <$(dep).wrap))
+ $(shell cat $<.wrap) $(foreach dep,$($@_TESTDEPS),$(shell cat $(dep).wrap))
--
2.7.4

View File

@ -0,0 +1,55 @@
From eab6fcf772e91a16428e0f3262e6b4ef81705f79 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Tue, 22 Jan 2019 21:29:56 -0500
Subject: [PATCH] multipathd: disable queueing for recreated map in
uev_remove_map
reason:disable queueing for recreated map in uev_remove_map
---
multipathd/main.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 8baf9ab..23fb9d4 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -674,7 +674,7 @@ uev_add_map (struct uevent * uev, struct vectors * vecs)
char *alias;
int major = -1, minor = -1, rc;
- condlog(3, "%s: add map (uevent)", uev->kernel);
+ condlog(2, "%s: add map (uevent)", uev->kernel);
alias = uevent_get_dm_name(uev);
if (!alias) {
condlog(3, "%s: No DM_NAME in uevent", uev->kernel);
@@ -793,7 +793,26 @@ uev_remove_map (struct uevent * uev, struct vectors * vecs)
uev->kernel, mpp->alias, alias);
goto out;
}
-
+ /*
+ * There may be a race window here:
+ * 1. all paths gone, causing map flushed both from multipathd and kernel
+ * 2. paths regenerated, causing multipathd creating the map again.
+ * 1 will generate a remove uevent which can be handled after 2,
+ * so we can disable queueing for the map created by 2 here temporarily
+ * and let the change uevent (generated by 2) calling uev_add_map
+ * ->setup_multipath to set queueing again. This can prevent
+ * the deadlock in this race window.
+ *
+ * The possible deadlock is: all udevd workers hangs in
+ * devices because of queue_if_no_path, so no udevd workers
+ * can handle new event and since multipathd will remove the map,
+ * the checkerloop cannot check this map's retry tick timeout
+ * and cancel the io hang which makes the udevd worker hang forever.
+ * multipathd cannot receive any uevent from udevd because all
+ * udevd workers hang there so the map cannot be recreated
+ * again which makes a deadlock.
+ */
+ dm_queue_if_no_path(alias, 0);
remove_map_and_stop_waiter(mpp, vecs);
out:
lock_cleanup_pop(vecs->lock);
--
1.8.3.1

View File

@ -16,9 +16,9 @@ index 09c3dcf..1b1cc55 100644
--- a/libmultipath/configure.c --- a/libmultipath/configure.c
+++ b/libmultipath/configure.c +++ b/libmultipath/configure.c
@@ -1021,6 +1021,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, @@ -1021,6 +1021,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
}
vector_foreach_slot (pathvec, pp1, k) { vector_foreach_slot (pathvec, pp1, k) {
int invalid = 0; int invalid;
+ condlog(3, "%s %s: start coalesce", pp1->dev, pp1->dev_t); + condlog(3, "%s %s: start coalesce", pp1->dev, pp1->dev_t);
/* skip this path for some reason */ /* skip this path for some reason */
@ -56,9 +56,9 @@ index ae847d6..99435c1 100644
pp->tpgs = TPGS_UNDEF; pp->tpgs = TPGS_UNDEF;
pp->priority = PRIO_UNDEF; pp->priority = PRIO_UNDEF;
+ pp->handled = 0; + pp->handled = 0;
pp->checkint = CHECKINT_UNDEF;
checker_clear(&pp->checker); checker_clear(&pp->checker);
dm_path_to_gen(pp)->ops = &dm_gen_path_ops; dm_path_to_gen(pp)->ops = &dm_gen_path_ops;
pp->hwe = vector_alloc();
diff --git a/libmultipath/structs.h b/libmultipath/structs.h diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 0a2623a..d667cb7 100644 index 0a2623a..d667cb7 100644
--- a/libmultipath/structs.h --- a/libmultipath/structs.h
@ -70,7 +70,7 @@ index 0a2623a..d667cb7 100644
+ int handled; + int handled;
int initialized; int initialized;
int retriggers; int retriggers;
int wwid_changed; unsigned int path_failures;
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index f87d69d..fba38c0 100644 index f87d69d..fba38c0 100644
--- a/libmultipath/structs_vec.c --- a/libmultipath/structs_vec.c

View File

@ -1,559 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 12 Jul 2018 17:53:38 -0500
Subject: [PATCH] multipath tests: add blacklist tests
These are tests to validate the filter_* blacklist functions. They not
only verify that the device is correctly blacklisted/whitelisted, but
they also verify the log messages that are printed out.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
tests/Makefile | 4 +-
tests/blacklist.c | 512 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 515 insertions(+), 1 deletion(-)
create mode 100644 tests/blacklist.c
diff --git a/tests/Makefile b/tests/Makefile
index d293c87..98b5c93 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -3,7 +3,7 @@ include ../Makefile.inc
CFLAGS += $(BIN_CFLAGS) -I$(multipathdir) -I$(mpathcmddir)
LIBDEPS += -L$(multipathdir) -lmultipath -lcmocka
-TESTS := uevent parser util dmevents hwtable
+TESTS := uevent parser util dmevents hwtable blacklist
.SILENT: $(TESTS:%=%.o)
.PRECIOUS: $(TESTS:%=%-test)
@@ -23,6 +23,8 @@ hwtable-test_TESTDEPS := test-lib.o
hwtable-test_OBJDEPS := ../libmultipath/discovery.o ../libmultipath/blacklist.o \
../libmultipath/prio.o ../libmultipath/callout.o ../libmultipath/structs.o
hwtable-test_LIBDEPS := -ludev -lpthread -ldl
+blacklist-test_OBJDEPS := ../libmultipath/blacklist.o
+blacklist-test_LIBDEPS := -ludev
%.out: %-test
@echo == running $< ==
diff --git a/tests/blacklist.c b/tests/blacklist.c
new file mode 100644
index 0000000..a55c1c0
--- /dev/null
+++ b/tests/blacklist.c
@@ -0,0 +1,512 @@
+/*
+ * Copyright (c) 2018 Benjamin Marzinski, Redhat
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+#include <stdarg.h>
+#include <stddef.h>
+#include <setjmp.h>
+#include <cmocka.h>
+#include "globals.c"
+#include "blacklist.h"
+#include "log.h"
+
+struct udev_device {
+ const char *sysname;
+ char *property_list[];
+};
+
+const char *
+__wrap_udev_device_get_sysname(struct udev_device *udev_device)
+{
+ assert_non_null(udev_device);
+ assert_non_null(udev_device->sysname);
+ return udev_device->sysname;
+}
+
+struct udev_list_entry *
+__wrap_udev_device_get_properties_list_entry(struct udev_device *udev_device)
+{
+ assert_non_null(udev_device);
+ if (!udev_device->property_list)
+ return NULL;
+ if (!*udev_device->property_list)
+ return NULL;
+ return (struct udev_list_entry *)udev_device->property_list;
+}
+
+struct udev_list_entry *
+__wrap_udev_list_entry_get_next(struct udev_list_entry *list_entry)
+{
+ assert_non_null(list_entry);
+ if (!*((char **)list_entry + 1))
+ return NULL;
+ return (struct udev_list_entry *)(((char **)list_entry) + 1);
+}
+
+const char *
+__wrap_udev_list_entry_get_name(struct udev_list_entry *list_entry)
+{
+ return *(const char **)list_entry;
+}
+
+void __wrap_dlog (int sink, int prio, const char * fmt, ...)
+{
+ char buff[MAX_MSG_SIZE];
+ va_list ap;
+
+ assert_int_equal(prio, mock_type(int));
+ va_start(ap, fmt);
+ vsnprintf(buff, MAX_MSG_SIZE, fmt, ap);
+ va_end(ap);
+ assert_string_equal(buff, mock_ptr_type(char *));
+}
+
+void expect_condlog(int prio, char *string)
+{
+ will_return(__wrap_dlog, prio);
+ will_return(__wrap_dlog, string);
+}
+
+vector blist_devnode_sdb;
+vector blist_all;
+vector blist_device_foo_bar;
+vector blist_device_all;
+vector blist_wwid_xyzzy;
+vector blist_protocol_fcp;
+vector blist_property_wwn;
+
+static int setup(void **state)
+{
+ blist_devnode_sdb = vector_alloc();
+ if (!blist_devnode_sdb ||
+ store_ble(blist_devnode_sdb, strdup("sdb"), ORIGIN_CONFIG))
+ return -1;
+
+ blist_all = vector_alloc();
+ if (!blist_all || store_ble(blist_all, strdup(".*"), ORIGIN_CONFIG))
+ return -1;
+
+ blist_device_foo_bar = vector_alloc();
+ if (!blist_device_foo_bar || alloc_ble_device(blist_device_foo_bar) ||
+ set_ble_device(blist_device_foo_bar, strdup("foo"), strdup("bar"),
+ ORIGIN_CONFIG))
+ return -1;
+
+ blist_device_all = vector_alloc();
+ if (!blist_device_all || alloc_ble_device(blist_device_all) ||
+ set_ble_device(blist_device_all, strdup(".*"), strdup(".*"),
+ ORIGIN_CONFIG))
+ return -1;
+
+ blist_wwid_xyzzy = vector_alloc();
+ if (!blist_wwid_xyzzy ||
+ store_ble(blist_wwid_xyzzy, strdup("xyzzy"), ORIGIN_CONFIG))
+ return -1;
+
+ blist_protocol_fcp = vector_alloc();
+ if (!blist_protocol_fcp ||
+ store_ble(blist_protocol_fcp, strdup("scsi:fcp"), ORIGIN_CONFIG))
+ return -1;
+
+ blist_property_wwn = vector_alloc();
+ if (!blist_property_wwn ||
+ store_ble(blist_property_wwn, strdup("ID_WWN"), ORIGIN_CONFIG))
+ return -1;
+
+ return 0;
+}
+
+static int teardown(void **state)
+{
+ free_blacklist(blist_devnode_sdb);
+ free_blacklist(blist_all);
+ free_blacklist_device(blist_device_foo_bar);
+ free_blacklist_device(blist_device_all);
+ free_blacklist(blist_wwid_xyzzy);
+ free_blacklist(blist_protocol_fcp);
+ free_blacklist(blist_property_wwn);
+ return 0;
+}
+
+static int reset_blists(void **state)
+{
+ conf.blist_devnode = NULL;
+ conf.blist_wwid = NULL;
+ conf.blist_property = NULL;
+ conf.blist_protocol = NULL;
+ conf.blist_device = NULL;
+ conf.elist_devnode = NULL;
+ conf.elist_wwid = NULL;
+ conf.elist_property = NULL;
+ conf.elist_protocol = NULL;
+ conf.elist_device = NULL;
+ return 0;
+}
+
+static void test_devnode_blacklist(void **state)
+{
+ expect_condlog(3, "sdb: device node name blacklisted\n");
+ assert_int_equal(filter_devnode(blist_devnode_sdb, NULL, "sdb"),
+ MATCH_DEVNODE_BLIST);
+}
+
+static void test_devnode_whitelist(void **state)
+{
+ expect_condlog(3, "sdb: device node name whitelisted\n");
+ assert_int_equal(filter_devnode(blist_all, blist_devnode_sdb, "sdb"),
+ MATCH_DEVNODE_BLIST_EXCEPT);
+ expect_condlog(3, "sdc: device node name blacklisted\n");
+ assert_int_equal(filter_devnode(blist_all, blist_devnode_sdb, "sdc"),
+ MATCH_DEVNODE_BLIST);
+}
+
+static void test_devnode_missing(void **state)
+{
+ assert_int_equal(filter_devnode(blist_devnode_sdb, NULL, "sdc"),
+ MATCH_NOTHING);
+}
+
+static void test_device_blacklist(void **state)
+{
+ expect_condlog(3, "sdb: (foo:bar) vendor/product blacklisted\n");
+ assert_int_equal(filter_device(blist_device_foo_bar, NULL, "foo",
+ "bar", "sdb"),
+ MATCH_DEVICE_BLIST);
+}
+
+static void test_device_whitelist(void **state)
+{
+ expect_condlog(3, "sdb: (foo:bar) vendor/product whitelisted\n");
+ assert_int_equal(filter_device(blist_device_all, blist_device_foo_bar,
+ "foo", "bar", "sdb"),
+ MATCH_DEVICE_BLIST_EXCEPT);
+ expect_condlog(3, "sdb: (foo:baz) vendor/product blacklisted\n");
+ assert_int_equal(filter_device(blist_device_all, blist_device_foo_bar,
+ "foo", "baz", "sdb"),
+ MATCH_DEVICE_BLIST);
+}
+
+static void test_device_missing(void **state)
+{
+ assert_int_equal(filter_device(blist_device_foo_bar, NULL, "foo",
+ "baz", "sdb"),
+ MATCH_NOTHING);
+}
+
+static void test_wwid_blacklist(void **state)
+{
+ expect_condlog(3, "sdb: wwid xyzzy blacklisted\n");
+ assert_int_equal(filter_wwid(blist_wwid_xyzzy, NULL, "xyzzy", "sdb"),
+ MATCH_WWID_BLIST);
+}
+
+static void test_wwid_whitelist(void **state)
+{
+ expect_condlog(3, "sdb: wwid xyzzy whitelisted\n");
+ assert_int_equal(filter_wwid(blist_all, blist_wwid_xyzzy,
+ "xyzzy", "sdb"),
+ MATCH_WWID_BLIST_EXCEPT);
+ expect_condlog(3, "sdb: wwid plugh blacklisted\n");
+ assert_int_equal(filter_wwid(blist_all, blist_wwid_xyzzy,
+ "plugh", "sdb"),
+ MATCH_WWID_BLIST);
+}
+
+static void test_wwid_missing(void **state)
+{
+ assert_int_equal(filter_wwid(blist_wwid_xyzzy, NULL, "plugh", "sdb"),
+ MATCH_NOTHING);
+}
+
+static void test_protocol_blacklist(void **state)
+{
+ struct path pp = { .dev = "sdb", .bus = SYSFS_BUS_SCSI,
+ .sg_id.proto_id = SCSI_PROTOCOL_FCP };
+ expect_condlog(3, "sdb: protocol scsi:fcp blacklisted\n");
+ assert_int_equal(filter_protocol(blist_protocol_fcp, NULL, &pp),
+ MATCH_PROTOCOL_BLIST);
+}
+
+static void test_protocol_whitelist(void **state)
+{
+ struct path pp1 = { .dev = "sdb", .bus = SYSFS_BUS_SCSI,
+ .sg_id.proto_id = SCSI_PROTOCOL_FCP };
+ struct path pp2 = { .dev = "sdb", .bus = SYSFS_BUS_SCSI,
+ .sg_id.proto_id = SCSI_PROTOCOL_ISCSI };
+ expect_condlog(3, "sdb: protocol scsi:fcp whitelisted\n");
+ assert_int_equal(filter_protocol(blist_all, blist_protocol_fcp, &pp1),
+ MATCH_PROTOCOL_BLIST_EXCEPT);
+ expect_condlog(3, "sdb: protocol scsi:iscsi blacklisted\n");
+ assert_int_equal(filter_protocol(blist_all, blist_protocol_fcp, &pp2),
+ MATCH_PROTOCOL_BLIST);
+}
+
+static void test_protocol_missing(void **state)
+{
+ struct path pp = { .dev = "sdb", .bus = SYSFS_BUS_SCSI,
+ .sg_id.proto_id = SCSI_PROTOCOL_ISCSI };
+ assert_int_equal(filter_protocol(blist_protocol_fcp, NULL, &pp),
+ MATCH_NOTHING);
+}
+
+static void test_property_blacklist(void **state)
+{
+ static struct udev_device udev = { "sdb", { "ID_FOO", "ID_WWN", "ID_BAR", NULL } };
+ conf.blist_property = blist_property_wwn;
+ expect_condlog(3, "sdb: udev property ID_WWN blacklisted\n");
+ assert_int_equal(filter_property(&conf, &udev), MATCH_PROPERTY_BLIST);
+}
+
+/* the property check works different in that you check all the property
+ * names, so setting a blacklist value will blacklist the device if any
+ * of the property on the blacklist are found before the property names
+ * in the whitelist. This might be worth changing. although it would
+ * force multipath to go through the properties twice */
+static void test_property_whitelist(void **state)
+{
+ static struct udev_device udev = { "sdb", { "ID_FOO", "ID_WWN", "ID_BAR", NULL } };
+ conf.elist_property = blist_property_wwn;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ assert_int_equal(filter_property(&conf, &udev),
+ MATCH_PROPERTY_BLIST_EXCEPT);
+}
+
+static void test_property_missing(void **state)
+{
+ static struct udev_device udev = { "sdb", { "ID_FOO", "ID_BAZ", "ID_BAR", NULL } };
+ conf.blist_property = blist_property_wwn;
+ expect_condlog(3, "sdb: blacklisted, udev property missing\n");
+ assert_int_equal(filter_property(&conf, &udev),
+ MATCH_PROPERTY_BLIST_MISSING);
+}
+
+struct udev_device test_udev = { "sdb", { "ID_FOO", "ID_WWN", "ID_BAR", NULL } };
+
+struct path test_pp = { .dev = "sdb", .bus = SYSFS_BUS_SCSI, .udev = &test_udev,
+ .sg_id.proto_id = SCSI_PROTOCOL_FCP, .vendor_id = "foo",
+ .product_id = "bar", .wwid = "xyzzy" };
+
+static void test_filter_path_property(void **state)
+{
+ conf.blist_property = blist_property_wwn;
+ expect_condlog(3, "sdb: udev property ID_WWN blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_PROPERTY_BLIST);
+}
+
+static void test_filter_path_devnode(void **state)
+{
+ /* always must include property elist, to avoid "missing property"
+ * blacklisting */
+ conf.elist_property = blist_property_wwn;
+ conf.blist_devnode = blist_devnode_sdb;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: device node name blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_DEVNODE_BLIST);
+}
+
+static void test_filter_path_device(void **state)
+{
+ /* always must include property elist, to avoid "missing property"
+ * blacklisting */
+ conf.elist_property = blist_property_wwn;
+ conf.blist_device = blist_device_foo_bar;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: (foo:bar) vendor/product blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_DEVICE_BLIST);
+}
+
+static void test_filter_path_protocol(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.blist_protocol = blist_protocol_fcp;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: protocol scsi:fcp blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_PROTOCOL_BLIST);
+}
+
+static void test_filter_path_wwid(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.blist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: wwid xyzzy blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_WWID_BLIST);
+}
+
+struct udev_device miss_udev = { "sdb", { "ID_FOO", "ID_BAZ", "ID_BAR", NULL } };
+
+struct path miss1_pp = { .dev = "sdc", .bus = SYSFS_BUS_SCSI,
+ .udev = &miss_udev,
+ .sg_id.proto_id = SCSI_PROTOCOL_ISCSI,
+ .vendor_id = "foo", .product_id = "baz",
+ .wwid = "plugh" };
+
+struct path miss2_pp = { .dev = "sdc", .bus = SYSFS_BUS_SCSI,
+ .udev = &test_udev,
+ .sg_id.proto_id = SCSI_PROTOCOL_ISCSI,
+ .vendor_id = "foo", .product_id = "baz",
+ .wwid = "plugh" };
+
+static void test_filter_path_missing1(void **state)
+{
+ conf.blist_property = blist_property_wwn;
+ conf.blist_devnode = blist_devnode_sdb;
+ conf.blist_device = blist_device_foo_bar;
+ conf.blist_protocol = blist_protocol_fcp;
+ conf.blist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: blacklisted, udev property missing\n");
+ assert_int_equal(filter_path(&conf, &miss1_pp),
+ MATCH_PROPERTY_BLIST_MISSING);
+}
+
+/* This one matches the property whitelist, to test the other missing
+ * functions */
+static void test_filter_path_missing2(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.blist_devnode = blist_devnode_sdb;
+ conf.blist_device = blist_device_foo_bar;
+ conf.blist_protocol = blist_protocol_fcp;
+ conf.blist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ assert_int_equal(filter_path(&conf, &miss2_pp),
+ MATCH_NOTHING);
+}
+
+static void test_filter_path_whitelist(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.elist_devnode = blist_devnode_sdb;
+ conf.elist_device = blist_device_foo_bar;
+ conf.elist_protocol = blist_protocol_fcp;
+ conf.elist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: device node name whitelisted\n");
+ expect_condlog(3, "sdb: (foo:bar) vendor/product whitelisted\n");
+ expect_condlog(3, "sdb: protocol scsi:fcp whitelisted\n");
+ expect_condlog(3, "sdb: wwid xyzzy whitelisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp),
+ MATCH_WWID_BLIST_EXCEPT);
+}
+
+static void test_filter_path_whitelist_property(void **state)
+{
+ conf.blist_property = blist_property_wwn;
+ conf.elist_devnode = blist_devnode_sdb;
+ conf.elist_device = blist_device_foo_bar;
+ conf.elist_protocol = blist_protocol_fcp;
+ conf.elist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_PROPERTY_BLIST);
+}
+
+static void test_filter_path_whitelist_devnode(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.blist_devnode = blist_devnode_sdb;
+ conf.elist_device = blist_device_foo_bar;
+ conf.elist_protocol = blist_protocol_fcp;
+ conf.elist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: device node name blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_DEVNODE_BLIST);
+}
+
+static void test_filter_path_whitelist_device(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.elist_devnode = blist_devnode_sdb;
+ conf.blist_device = blist_device_foo_bar;
+ conf.elist_protocol = blist_protocol_fcp;
+ conf.elist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: device node name whitelisted\n");
+ expect_condlog(3, "sdb: (foo:bar) vendor/product blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_DEVICE_BLIST);
+}
+
+static void test_filter_path_whitelist_protocol(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.elist_devnode = blist_devnode_sdb;
+ conf.elist_device = blist_device_foo_bar;
+ conf.blist_protocol = blist_protocol_fcp;
+ conf.elist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: device node name whitelisted\n");
+ expect_condlog(3, "sdb: (foo:bar) vendor/product whitelisted\n");
+ expect_condlog(3, "sdb: protocol scsi:fcp blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_PROTOCOL_BLIST);
+}
+
+static void test_filter_path_whitelist_wwid(void **state)
+{
+ conf.elist_property = blist_property_wwn;
+ conf.elist_devnode = blist_devnode_sdb;
+ conf.elist_device = blist_device_foo_bar;
+ conf.elist_protocol = blist_protocol_fcp;
+ conf.blist_wwid = blist_wwid_xyzzy;
+ expect_condlog(3, "sdb: udev property ID_WWN whitelisted\n");
+ expect_condlog(3, "sdb: device node name whitelisted\n");
+ expect_condlog(3, "sdb: (foo:bar) vendor/product whitelisted\n");
+ expect_condlog(3, "sdb: protocol scsi:fcp whitelisted\n");
+ expect_condlog(3, "sdb: wwid xyzzy blacklisted\n");
+ assert_int_equal(filter_path(&conf, &test_pp), MATCH_WWID_BLIST);
+}
+
+#define test_and_reset(x) cmocka_unit_test_teardown((x), reset_blists)
+
+int test_blacklist(void)
+{
+ const struct CMUnitTest tests[] = {
+ cmocka_unit_test(test_devnode_blacklist),
+ cmocka_unit_test(test_devnode_whitelist),
+ cmocka_unit_test(test_devnode_missing),
+ cmocka_unit_test(test_device_blacklist),
+ cmocka_unit_test(test_device_whitelist),
+ cmocka_unit_test(test_device_missing),
+ cmocka_unit_test(test_wwid_blacklist),
+ cmocka_unit_test(test_wwid_whitelist),
+ cmocka_unit_test(test_wwid_missing),
+ cmocka_unit_test(test_protocol_blacklist),
+ cmocka_unit_test(test_protocol_whitelist),
+ cmocka_unit_test(test_protocol_missing),
+ test_and_reset(test_property_blacklist),
+ test_and_reset(test_property_whitelist),
+ test_and_reset(test_property_missing),
+ test_and_reset(test_filter_path_property),
+ test_and_reset(test_filter_path_devnode),
+ test_and_reset(test_filter_path_device),
+ test_and_reset(test_filter_path_protocol),
+ test_and_reset(test_filter_path_wwid),
+ test_and_reset(test_filter_path_missing1),
+ test_and_reset(test_filter_path_missing2),
+ test_and_reset(test_filter_path_whitelist),
+ test_and_reset(test_filter_path_whitelist_property),
+ test_and_reset(test_filter_path_whitelist_devnode),
+ test_and_reset(test_filter_path_whitelist_device),
+ test_and_reset(test_filter_path_whitelist_protocol),
+ test_and_reset(test_filter_path_whitelist_wwid),
+ };
+ return cmocka_run_group_tests(tests, setup, teardown);
+}
+
+int main(void)
+{
+ int ret = 0;
+ ret += test_blacklist();
+ return ret;
+}
--
2.7.4

View File

@ -1,4 +1,4 @@
From a9b5625e0dba3b76832b17c6fbb34840f1a91653 Mon Sep 17 00:00:00 2001 From 96ebdd776e676d24ddb5c6c877e2e13ece1717b3 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com> From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 01:57:33 -0500 Date: Wed, 23 Jan 2019 01:57:33 -0500
Subject: [PATCH] fix bugs backported from next branch Subject: [PATCH] fix bugs backported from next branch
@ -13,10 +13,10 @@ reason:fix bugs backported from next branch
5 files changed, 25 insertions(+), 10 deletions(-) 5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c
index 03d0a0e..1400b11 100644 index 0ab06e2..e65b6f5 100644
--- a/libmultipath/prioritizers/alua.c --- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c +++ b/libmultipath/prioritizers/alua.c
@@ -128,15 +128,19 @@ int getprio (struct path * pp, char * args, unsigned int timeout) @@ -131,15 +131,19 @@ int getprio (struct path * pp, char * args, unsigned int timeout)
switch(-rc) { switch(-rc) {
case ALUA_PRIO_NOT_SUPPORTED: case ALUA_PRIO_NOT_SUPPORTED:
condlog(0, "%s: alua not supported", pp->dev); condlog(0, "%s: alua not supported", pp->dev);
@ -37,7 +37,7 @@ index 03d0a0e..1400b11 100644
} }
} }
diff --git a/libmultipath/prioritizers/emc.c b/libmultipath/prioritizers/emc.c diff --git a/libmultipath/prioritizers/emc.c b/libmultipath/prioritizers/emc.c
index a2f7487..c5382e0 100644 index 3b63cca..c40f88a 100644
--- a/libmultipath/prioritizers/emc.c --- a/libmultipath/prioritizers/emc.c
+++ b/libmultipath/prioritizers/emc.c +++ b/libmultipath/prioritizers/emc.c
@@ -19,7 +19,7 @@ int emc_clariion_prio(const char *dev, int fd, unsigned int timeout) @@ -19,7 +19,7 @@ int emc_clariion_prio(const char *dev, int fd, unsigned int timeout)
@ -50,7 +50,7 @@ index a2f7487..c5382e0 100644
memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
memset(&sense_buffer, 0, 128); memset(&sense_buffer, 0, 128);
diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c
index 70fb5d1..56d182b 100644 index 88cac5f..075751c 100644
--- a/libmultipath/prioritizers/hds.c --- a/libmultipath/prioritizers/hds.c
+++ b/libmultipath/prioritizers/hds.c +++ b/libmultipath/prioritizers/hds.c
@@ -98,10 +98,12 @@ int hds_modular_prio (const char *dev, int fd, unsigned int timeout) @@ -98,10 +98,12 @@ int hds_modular_prio (const char *dev, int fd, unsigned int timeout)
@ -116,12 +116,12 @@ index 70fb5d1..56d182b 100644
+ return ret; + return ret;
} }
int getprio (struct path * pp, char * args, unsigned int timeout) int getprio (struct path * pp, __attribute__((unused)) char *args,
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index fba38c0..d85eb5f 100644 index 38cf1e9..790143d 100644
--- a/libmultipath/structs_vec.c --- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c
@@ -32,8 +32,10 @@ int update_mpp_paths(struct multipath *mpp, vector pathvec) @@ -34,8 +34,10 @@ int update_mpp_paths(struct multipath *mpp, vector pathvec)
return 0; return 0;
if (!mpp->paths && if (!mpp->paths &&
@ -134,10 +134,10 @@ index fba38c0..d85eb5f 100644
vector_foreach_slot (mpp->pg, pgp, i) { vector_foreach_slot (mpp->pg, pgp, i) {
vector_foreach_slot (pgp->paths, pp, j) { vector_foreach_slot (pgp->paths, pp, j) {
diff --git a/multipathd/main.c b/multipathd/main.c diff --git a/multipathd/main.c b/multipathd/main.c
index 9dd74ad..7a80688 100644 index 23fb9d4..ef14750 100644
--- a/multipathd/main.c --- a/multipathd/main.c
+++ b/multipathd/main.c +++ b/multipathd/main.c
@@ -1624,6 +1624,11 @@ enable_group(struct path * pp) @@ -1665,6 +1665,11 @@ enable_group(struct path * pp)
pgp = VECTOR_SLOT(pp->mpp->pg, pp->pgindex - 1); pgp = VECTOR_SLOT(pp->mpp->pg, pp->pgindex - 1);
@ -150,5 +150,5 @@ index 9dd74ad..7a80688 100644
condlog(2, "%s: enable group #%i", pp->mpp->alias, pp->pgindex); condlog(2, "%s: enable group #%i", pp->mpp->alias, pp->pgindex);
dm_enablegroup(pp->mpp->alias, pp->pgindex); dm_enablegroup(pp->mpp->alias, pp->pgindex);
-- --
2.19.1 1.8.3.1

View File

@ -1,25 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Mon, 16 Jul 2018 16:43:57 -0500
Subject: [PATCH] mpathpersist: add missing --param-rk usage info
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
mpathpersist/main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 99151fe..0e4d3f2 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -705,6 +705,7 @@ static void usage(void)
" --param-alltgpt|-Y PR Out parameter 'ALL_TG_PT\n"
" --param-aptpl|-Z PR Out parameter 'APTPL'\n"
" --read-keys|-k PR In: Read Keys\n"
+ " --param-rk=RK|-K RK PR Out parameter reservation key\n"
" --param-sark=SARK|-S SARK PR Out parameter service "
"action\n"
" reservation key (SARK is in "
--
2.7.4

View File

@ -21,8 +21,8 @@ index 691b4e1..a2907db 100644
+ uint64_t uireservation = {0}; + uint64_t uireservation = {0};
+ int j; + int j;
conf = get_multipath_config(); ret = mpath_get_map(fd, &alias, &mpp);
conf->verbosity = verbose; if (ret != MPATH_PR_SUCCESS)
@@ -353,8 +356,15 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, @@ -353,8 +356,15 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
} }
} }

View File

@ -1,4 +1,4 @@
From de2078dd66a62ca7ba2ae6adc406311e830572fa Mon Sep 17 00:00:00 2001 From ed732bcdc90162993e82df1bec8642aabb7a64a5 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com> From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 02:38:00 -0500 Date: Wed, 23 Jan 2019 02:38:00 -0500
Subject: [PATCH] ignore for clear mismatch key Subject: [PATCH] ignore for clear mismatch key
@ -9,10 +9,10 @@ reason:ignore for clear mismatch key
1 file changed, 11 insertions(+), 6 deletions(-) 1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index a2907db..27c848c 100644 index f9c3be9..027d006 100644
--- a/libmpathpersist/mpath_persist.c --- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c
@@ -345,7 +345,8 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, @@ -309,7 +309,8 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey && if (mpp->prkey_source == PRKEY_SOURCE_FILE && prkey &&
((!get_be64(mpp->reservation_key) && ((!get_be64(mpp->reservation_key) &&
rq_servact == MPATH_PROUT_REG_SA) || rq_servact == MPATH_PROUT_REG_SA) ||
@ -22,7 +22,7 @@ index a2907db..27c848c 100644
memcpy(&mpp->reservation_key, paramp->sa_key, 8); memcpy(&mpp->reservation_key, paramp->sa_key, 8);
if (update_prkey_flags(alias, get_be64(mpp->reservation_key), if (update_prkey_flags(alias, get_be64(mpp->reservation_key),
paramp->sa_flags)) { paramp->sa_flags)) {
@@ -362,12 +363,16 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, @@ -326,12 +327,16 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
uireservation >>= 8; uireservation >>= 8;
} }

View File

@ -1,19 +1,18 @@
From f637f15dacc660f663a6cf36e3fe8f7a0cc9f9e4 Mon Sep 17 00:00:00 2001 From a1461cbfa7ea2bccef20eb2f5275648452ee050c Mon Sep 17 00:00:00 2001
From: chenminhua <chenminhua1@huawei.com> From: chenminhua <chenminhua1@huawei.com>
Date: Mon, 2 Apr 2018 04:01:04 -0400 Date: Mon, 2 Apr 2018 04:01:04 -0400
Subject: [PATCH] 1hostos-patch-upgrade:0330 hotpatch modify Subject: [PATCH] 1hostos-patch-upgrade:0330 hotpatch modify
[Changelog]:add upgrade path [Changelog]:add upgrade path
[Author]:chenminhua [Author]:chenminhua
--- ---
libmultipath/discovery.c | 129 +++++++++++++++++++++++++++++++++++++-- libmultipath/discovery.c | 124 +++++++++++++++++++++++++++++++++++++++++++++--
libmultipath/discovery.h | 1 + libmultipath/discovery.h | 1 +
multipathd/main.c | 4 ++ multipathd/main.c | 4 ++
3 files changed, 128 insertions(+), 6 deletions(-) 3 files changed, 124 insertions(+), 5 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 0b1855d..95eb3a0 100644 index ee3290c..c49848e 100644
--- a/libmultipath/discovery.c --- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c +++ b/libmultipath/discovery.c
@@ -34,6 +34,103 @@ @@ -34,6 +34,103 @@
@ -117,10 +116,10 @@ index 0b1855d..95eb3a0 100644
+ return 0; + return 0;
+} +}
+ +
int struct vpd_vendor_page vpd_vendor_pages[VPD_VP_ARRAY_SIZE] = {
alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice, [VPD_VP_UNDEF] = { 0x00, "undef" },
const char *wwid, int flag, struct path **pp_ptr) [VPD_VP_HP3PAR] = { 0xc0, "hp3par" },
@@ -118,6 +215,7 @@ path_discover (vector pathvec, struct config * conf, @@ -124,6 +221,7 @@ path_discover (vector pathvec, struct config * conf,
{ {
struct path * pp; struct path * pp;
const char * devname; const char * devname;
@ -128,13 +127,14 @@ index 0b1855d..95eb3a0 100644
devname = udev_device_get_sysname(udevice); devname = udev_device_get_sysname(udevice);
if (!devname) if (!devname)
@@ -131,11 +229,22 @@ path_discover (vector pathvec, struct config * conf, @@ -137,12 +235,22 @@ path_discover (vector pathvec, struct config * conf,
snprintf(devt, BLK_DEV_SIZE, "%d:%d", snprintf(devt, BLK_DEV_SIZE, "%d:%d",
major(devnum), minor(devnum)); major(devnum), minor(devnum));
pp = find_path_by_devt(pathvec, devt); pp = find_path_by_devt(pathvec, devt);
- if (!pp) - if (!pp)
- return store_pathinfo(pathvec, conf, - return store_pathinfo(pathvec, conf,
- udevice, flag, NULL); - udevice, flag | DI_BLACKLIST,
- NULL);
+ if (!pp) { + if (!pp) {
+ err = store_pathinfo(pathvec, conf, + err = store_pathinfo(pathvec, conf,
+ udevice, flag, &pp); + udevice, flag, &pp);
@ -154,43 +154,37 @@ index 0b1855d..95eb3a0 100644
+ return err; + return err;
} }
int static void cleanup_udev_enumerate_ptr(void *arg)
@@ -1882,8 +1991,16 @@ int pathinfo(struct path *pp, struct config *conf, int mask) @@ -2091,6 +2199,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
/*
* fetch info available in sysfs if (rc != PATHINFO_OK)
*/ return rc;
- if (mask & DI_SYSFS && sysfs_pathinfo(pp, conf->hwtable))
- return PATHINFO_FAILED;
+ if (mask & DI_SYSFS) {
+ if (sysfs_pathinfo(pp, conf->hwtable))
+ return 1;
+ +
+ /* free local device */ + /* free local device */
+ if (transport(pp->sg_id.host_no)) { + if (transport(pp->sg_id.host_no)) {
+ condlog(3, "%s is a local device", pp->dev); + condlog(3, "%s is a local device", pp->dev);
+ return 0; + return 0;
+ } + }
+ } }
if (mask & DI_BLACKLIST && mask & DI_SYSFS) { if (mask & DI_BLACKLIST && mask & DI_SYSFS) {
if (filter_device(conf->blist_device, conf->elist_device,
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 9aacf75..c4b1d25 100644 index 6444887..a438b44 100644
--- a/libmultipath/discovery.h --- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h +++ b/libmultipath/discovery.h
@@ -53,6 +53,7 @@ ssize_t sysfs_get_vpd (struct udev_device * udev, int pg, unsigned char * buff, @@ -56,6 +56,7 @@ int sysfs_get_asymmetric_access_state(struct path *pp,
int sysfs_get_asymmetric_access_state(struct path *pp,
char *buff, int buflen); char *buff, int buflen);
int get_uid(struct path * pp, int path_state, struct udev_device *udev); int get_uid(struct path * pp, int path_state, struct udev_device *udev,
int allow_fallback);
+int remove_local_path(vector pathvec, struct path *pp); +int remove_local_path(vector pathvec, struct path *pp);
/* /*
* discovery bitmask * discovery bitmask
diff --git a/multipathd/main.c b/multipathd/main.c diff --git a/multipathd/main.c b/multipathd/main.c
index 7a80688..c2757c4 100644 index ef14750..41c4258 100644
--- a/multipathd/main.c --- a/multipathd/main.c
+++ b/multipathd/main.c +++ b/multipathd/main.c
@@ -917,6 +917,10 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) @@ -943,6 +943,10 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int start_waiter = 0; int start_waiter = 0;
int ret; int ret;
@ -202,5 +196,5 @@ index 7a80688..c2757c4 100644
* need path UID to go any further * need path UID to go any further
*/ */
-- --
2.19.1 1.8.3.1

View File

@ -1,17 +0,0 @@
diff -uNr a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
--- a/libmpathpersist/mpath_persist.c 2017-05-24 11:01:39.000000000 +0800
+++ b/libmpathpersist/mpath_persist.c 2017-05-24 11:02:22.000000000 +0800
@@ -510,10 +510,10 @@
if (!rollback && (thread[i].param.status == MPATH_PR_RESERV_CONFLICT)){
rollback = 1;
sa_key = 0;
- for (i = 0; i < 8; ++i){
- if (i > 0)
+ for (j = 0; j < 8; ++j){
+ if (j > 0)
sa_key <<= 8;
- sa_key |= paramp->sa_key[i];
+ sa_key |= paramp->sa_key[j];
}
status = MPATH_PR_RESERV_CONFLICT ;
}

View File

@ -1,23 +1,21 @@
From 3142e137afb8dd2bd99398d05b3c24ac9a9fd68e Mon Sep 17 00:00:00 2001
From: "wangjun196@huawei.com" <wangjun196@huawei.com>
Date: Thu, 16 Jul 2020 18:03:30 +0800
Subject: [PATCH] 1
---
libmpathpersist/mpath_persist.c | 12 ++++++++++--
libmpathpersist/mpath_pr_ioctl.c | 28 ++++++++++++++--------------
2 files changed, 24 insertions(+), 16 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 27c848c..1e6a172 100644 index 3da7a6c..0ae504e 100644
--- a/libmpathpersist/mpath_persist.c --- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c
@@ -199,6 +199,11 @@ int mpath_persistent_reserve_in (int fd, int rq_servact, @@ -244,10 +244,14 @@ static int mpath_get_map(int fd, char **palias, struct multipath **pmpp)
if (map_present && !dm_is_mpath(alias)){
condlog( 0, "%s: not a multipath device.", alias);
ret = MPATH_PR_DMMP_ERROR;
+ if (curmp)
+ vector_free(curmp);
+ if (pathvec)
+ vector_free(pathvec);
+
goto out;
}
@@ -297,6 +302,10 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, if (dm_map_present(alias) && dm_is_mpath(alias) != 1){
if (map_present && !dm_is_mpath(alias)){
condlog(3, "%s: not a multipath device.", alias); condlog(3, "%s: not a multipath device.", alias);
ret = MPATH_PR_DMMP_ERROR;
+ if (curmp) + if (curmp)
+ vector_free(curmp); + vector_free(curmp);
+ if (pathvec) + if (pathvec)
@ -25,16 +23,12 @@ index 27c848c..1e6a172 100644
goto out; goto out;
} }
@@ -321,7 +330,7 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
goto out1;
}
- /* get info of all paths from the dm device */ - /* get info of all paths from the dm device */
+ /* get info of all paths from the dm device */ + /* get info of all paths from the dm device */
if (get_mpvec(curmp, pathvec, alias)){ if (get_mpvec(curmp, pathvec, alias)){
condlog(0, "%s: failed to get device info.", alias); condlog(0, "%s: failed to get device info.", alias);
ret = MPATH_PR_DMMP_ERROR; goto out;
@@ -882,7 +891,7 @@ out: @@ -823,7 +827,7 @@ out:
return (status); return (status);
} }
@ -43,7 +37,7 @@ index 27c848c..1e6a172 100644
{ {
void * ptr = NULL; void * ptr = NULL;
int size=0; int size=0;
@@ -905,6 +914,10 @@ void * mpath_alloc_prin_response(int prin_sa) @@ -846,6 +850,10 @@ void * mpath_alloc_prin_response(int prin_sa)
if (size > 0) if (size > 0)
{ {
ptr = calloc(size, 1); ptr = calloc(size, 1);
@ -55,46 +49,46 @@ index 27c848c..1e6a172 100644
return ptr; return ptr;
} }
diff --git a/libmpathpersist/mpath_pr_ioctl.c b/libmpathpersist/mpath_pr_ioctl.c diff --git a/libmpathpersist/mpath_pr_ioctl.c b/libmpathpersist/mpath_pr_ioctl.c
index 6dd7403..b317b4e 100644 index 74b26b0..8a78693 100644
--- a/libmpathpersist/mpath_pr_ioctl.c --- a/libmpathpersist/mpath_pr_ioctl.c
+++ b/libmpathpersist/mpath_pr_ioctl.c +++ b/libmpathpersist/mpath_pr_ioctl.c
@@ -25,8 +25,8 @@ @@ -23,8 +23,8 @@
#define MAXRETRY 5
int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp *resp, int noisy); int prin_do_scsi_ioctl(char * dev, int rq_servact, struct prin_resp *resp, int noisy);
void mpath_format_readkeys(struct prin_resp *pr_buff, int len , int noisy);
void mpath_format_readfullstatus(struct prin_resp *pr_buff, int len, int noisy);
-int mpath_translate_response (char * dev, struct sg_io_hdr io_hdr, -int mpath_translate_response (char * dev, struct sg_io_hdr io_hdr,
- SenseData_t *Sensedata, int noisy); - SenseData_t *Sensedata);
+int mpath_translate_response (const char *dev, struct sg_io_hdr *io_hdr, +int mpath_translate_response (const char * dev, struct sg_io_hdr *io_hdr,
+ const SenseData_t *Sensedata, int noisy); + const SenseData_t *Sensedata);
void dumpHex(const char* str, int len, int no_ascii); void dumpHex(const char* str, int len, int no_ascii);
int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope, int prout_do_scsi_ioctl( char * dev, int rq_servact, int rq_scope,
unsigned int rq_type, struct prout_param_descriptor *paramp, int noisy); unsigned int rq_type, struct prout_param_descriptor *paramp, int noisy);
@@ -115,7 +115,7 @@ retry : @@ -113,7 +113,7 @@ retry :
condlog(4, "%s: Duration=%u (ms)", dev, io_hdr.duration); condlog(4, "%s: Duration=%u (ms)", dev, io_hdr.duration);
- status = mpath_translate_response(dev, io_hdr, &Sensedata, noisy); - status = mpath_translate_response(dev, io_hdr, &Sensedata);
+ status = mpath_translate_response(dev, &io_hdr, &Sensedata, noisy); + status = mpath_translate_response(dev, &io_hdr, &Sensedata);
condlog(3, "%s: status = %d", dev, status); condlog(3, "%s: status = %d", dev, status);
if (status == MPATH_PR_SENSE_UNIT_ATTENTION && (retry > 0)) if (status == MPATH_PR_SENSE_UNIT_ATTENTION && (retry > 0))
@@ -354,7 +354,7 @@ retry : @@ -359,7 +359,7 @@ retry :
condlog(3, "%s: duration = %u (ms)", dev, io_hdr.duration); condlog(3, "%s: duration = %u (ms)", dev, io_hdr.duration);
condlog(4, "%s: persistent reservation in: requested %d bytes but got %d bytes)", dev, mx_resp_len, got); condlog(4, "%s: persistent reservation in: requested %d bytes but got %d bytes)", dev, mx_resp_len, got);
- status = mpath_translate_response(dev, io_hdr, &Sensedata, noisy); - status = mpath_translate_response(dev, io_hdr, &Sensedata);
+ status = mpath_translate_response(dev, &io_hdr, &Sensedata, noisy); + status = mpath_translate_response(dev, &io_hdr, &Sensedata);
if (status == MPATH_PR_SENSE_UNIT_ATTENTION && (retry > 0)) if (status == MPATH_PR_SENSE_UNIT_ATTENTION && (retry > 0))
{ {
@@ -399,18 +399,18 @@ out: @@ -404,18 +404,18 @@ out:
return status; return status;
} }
-int mpath_translate_response (char * dev, struct sg_io_hdr io_hdr, -int mpath_translate_response (char * dev, struct sg_io_hdr io_hdr,
- SenseData_t *Sensedata, int noisy) - SenseData_t *Sensedata)
+int mpath_translate_response (const char *dev, struct sg_io_hdr *io_hdr, +int mpath_translate_response (const char *dev, struct sg_io_hdr *io_hdr,
+ const SenseData_t *Sensedata, int noisy) + const SenseData_t *Sensedata)
{ {
condlog(3, "%s: status driver:%02x host:%02x scsi:%02x", dev, condlog(3, "%s: status driver:%02x host:%02x scsi:%02x", dev,
- io_hdr.driver_status, io_hdr.host_status ,io_hdr.status); - io_hdr.driver_status, io_hdr.host_status ,io_hdr.status);
@ -114,7 +108,7 @@ index 6dd7403..b317b4e 100644
case SAM_STAT_GOOD: case SAM_STAT_GOOD:
break; break;
case SAM_STAT_CHECK_CONDITION: case SAM_STAT_CHECK_CONDITION:
@@ -450,13 +450,13 @@ int mpath_translate_response (char * dev, struct sg_io_hdr io_hdr, @@ -455,13 +455,13 @@ int mpath_translate_response (char * dev, struct sg_io_hdr io_hdr,
return MPATH_PR_OTHER; return MPATH_PR_OTHER;
} }
@ -130,33 +124,6 @@ index 6dd7403..b317b4e 100644
{ {
case DRIVER_OK: case DRIVER_OK:
break; break;
diff --git a/mpathpersist/main.c b/mpathpersist/main.c --
index 0e4d3f2..4db07b2 100644 1.8.3.1
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -61,7 +61,7 @@ struct udev *udev;
int main (int argc, char * argv[])
{
- int fd, c, res;
+ int c, res, fd = -1;
const char *device_name = NULL;
int num_prin_sa = 0;
int num_prout_sa = 0;
@@ -488,6 +488,7 @@ int main (int argc, char * argv[])
}
res = close (fd);
+ fd = -1;
if (res < 0)
{
mpath_lib_exit(conf);
@@ -496,6 +497,8 @@ int main (int argc, char * argv[])
}
out :
+ if (fd >= 0)
+ close(fd);
mpath_lib_exit(conf);
udev_unref(udev);
return (ret >= 0) ? ret : MPATH_PR_OTHER;

View File

@ -1,55 +0,0 @@
From 4098378d2e976c9b371ae6bf83e802fb32187f50 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Tue, 22 Jan 2019 21:29:56 -0500
Subject: [PATCH] multipathd: disable queueing for recreated map in
uev_remove_map
reason:disable queueing for recreated map in uev_remove_map
---
multipathd/main.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index cc493c1..9dd74ad 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -647,7 +647,7 @@ uev_add_map (struct uevent * uev, struct vectors * vecs)
char *alias;
int major = -1, minor = -1, rc;
- condlog(3, "%s: add map (uevent)", uev->kernel);
+ condlog(2, "%s: add map (uevent)", uev->kernel);
alias = uevent_get_dm_name(uev);
if (!alias) {
condlog(3, "%s: No DM_NAME in uevent", uev->kernel);
@@ -766,7 +766,26 @@ uev_remove_map (struct uevent * uev, struct vectors * vecs)
mpp->alias, mpp->dmi->minor, minor);
goto out;
}
-
+ /*
+ * There may be a race window here:
+ * 1. all paths gone, causing map flushed both from multipathd and kernel
+ * 2. paths regenerated, causing multipathd creating the map again.
+ * 1 will generate a remove uevent which can be handled after 2,
+ * so we can disable queueing for the map created by 2 here temporarily
+ * and let the change uevent (generated by 2) calling uev_add_map
+ * ->setup_multipath to set queueing again. This can prevent
+ * the deadlock in this race window.
+ *
+ * The possible deadlock is: all udevd workers hangs in
+ * devices because of queue_if_no_path, so no udevd workers
+ * can handle new event and since multipathd will remove the map,
+ * the checkerloop cannot check this map's retry tick timeout
+ * and cancel the io hang which makes the udevd worker hang forever.
+ * multipathd cannot receive any uevent from udevd because all
+ * udevd workers hang there so the map cannot be recreated
+ * again which makes a deadlock.
+ */
+ dm_queue_if_no_path(alias, 0);
orphan_paths(vecs->pathvec, mpp);
remove_map_and_stop_waiter(mpp, vecs);
out:
--
1.8.3.1

View File

@ -1,8 +1,8 @@
From 2c3047d7f6bd8cdd1d92cab32893cecdd5a1dfa9 Mon Sep 17 00:00:00 2001 From 4ac8e63deadf125004eacbc76859cfa7a46e1e16 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain> From: root <root@localhost.localdomain>
Date: Fri, 22 Mar 2019 19:48:35 +0800 Date: Fri, 22 Mar 2019 19:48:35 +0800
Subject: [PATCH] clear mpp path reference when path is freed, otherwise double Subject: [PATCH] clear mpp path reference when path is freed, otherwise double
free may occur in verify_paths. free may occur in verify_paths.
call stack: call stack:
vecs=vecs@entry=0x557b01d62140, rpvec=rpvec@entry=0x0) at structs_vec.c:521 vecs=vecs@entry=0x557b01d62140, rpvec=rpvec@entry=0x0) at structs_vec.c:521
@ -17,7 +17,7 @@ call stack:
3 files changed, 29 insertions(+), 6 deletions(-) 3 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 53fc67a..305d27c 100644 index c49848e..2458bf5 100644
--- a/libmultipath/discovery.c --- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c +++ b/libmultipath/discovery.c
@@ -112,7 +112,7 @@ transport (int h) @@ -112,7 +112,7 @@ transport (int h)
@ -40,7 +40,7 @@ index 53fc67a..305d27c 100644
return 0; return 0;
} }
@@ -235,7 +237,7 @@ path_discover (vector pathvec, struct config * conf, @@ -241,7 +243,7 @@ path_discover (vector pathvec, struct config * conf,
if (err == 1) if (err == 1)
return 1; return 1;
if (err == 0) if (err == 0)
@ -49,7 +49,7 @@ index 53fc67a..305d27c 100644
return 0; return 0;
} }
} }
@@ -243,7 +245,7 @@ path_discover (vector pathvec, struct config * conf, @@ -249,7 +251,7 @@ path_discover (vector pathvec, struct config * conf,
if (err) if (err)
return err; return err;
@ -59,23 +59,23 @@ index 53fc67a..305d27c 100644
} }
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index c4b1d25..0fb0d3a 100644 index a438b44..ab73493 100644
--- a/libmultipath/discovery.h --- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h +++ b/libmultipath/discovery.h
@@ -53,7 +53,7 @@ ssize_t sysfs_get_vpd (struct udev_device * udev, int pg, unsigned char * buff, @@ -56,7 +56,7 @@ int sysfs_get_asymmetric_access_state(struct path *pp,
int sysfs_get_asymmetric_access_state(struct path *pp,
char *buff, int buflen); char *buff, int buflen);
int get_uid(struct path * pp, int path_state, struct udev_device *udev); int get_uid(struct path * pp, int path_state, struct udev_device *udev,
int allow_fallback);
-int remove_local_path(vector pathvec, struct path *pp); -int remove_local_path(vector pathvec, struct path *pp);
+int remove_local_path(vector pathvec, struct path *pp, int isfree); +int remove_local_path(vector pathvec, struct path *pp, int isfree);
/* /*
* discovery bitmask * discovery bitmask
diff --git a/multipathd/main.c b/multipathd/main.c diff --git a/multipathd/main.c b/multipathd/main.c
index b180f2a..8de0871 100644 index 41c4258..09ea102 100644
--- a/multipathd/main.c --- a/multipathd/main.c
+++ b/multipathd/main.c +++ b/multipathd/main.c
@@ -815,6 +815,21 @@ ev_remove_map (char * devname, char * alias, int minor, struct vectors * vecs) @@ -841,6 +841,21 @@ ev_remove_map (char * devname, char * alias, int minor, struct vectors * vecs)
return flush_map(mpp, vecs, 0); return flush_map(mpp, vecs, 0);
} }
@ -97,7 +97,7 @@ index b180f2a..8de0871 100644
static int static int
uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map)
{ {
@@ -857,6 +872,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) @@ -883,6 +898,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map)
i = find_slot(vecs->pathvec, (void *)pp); i = find_slot(vecs->pathvec, (void *)pp);
if (i != -1) if (i != -1)
vector_del_slot(vecs->pathvec, i); vector_del_slot(vecs->pathvec, i);
@ -105,7 +105,7 @@ index b180f2a..8de0871 100644
free_path(pp); free_path(pp);
} else { } else {
condlog(0, "%s: failed to reinitialize path", condlog(0, "%s: failed to reinitialize path",
@@ -918,8 +934,11 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) @@ -944,8 +960,11 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int ret; int ret;
/* if pp is local path,remove it and return 0. */ /* if pp is local path,remove it and return 0. */
@ -118,15 +118,15 @@ index b180f2a..8de0871 100644
/* /*
* need path UID to go any further * need path UID to go any further
@@ -950,6 +969,7 @@ rescan: @@ -960,6 +979,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int i = find_slot(vecs->pathvec, (void *)pp); int i = find_slot(vecs->pathvec, (void *)pp);
if (i != -1) if (i != -1)
vector_del_slot(vecs->pathvec, i); vector_del_slot(vecs->pathvec, i);
+ clear_ref_from_mpp(pp, vecs); + clear_ref_from_mpp(pp, vecs);
free_path(pp); free_path(pp);
return 1; return 1;
} }
@@ -1182,6 +1202,7 @@ out: @@ -1205,6 +1225,7 @@ out:
if ((i = find_slot(vecs->pathvec, (void *)pp)) != -1) if ((i = find_slot(vecs->pathvec, (void *)pp)) != -1)
vector_del_slot(vecs->pathvec, i); vector_del_slot(vecs->pathvec, i);
@ -135,5 +135,5 @@ index b180f2a..8de0871 100644
return retval; return retval;
-- --
2.19.1 1.8.3.1

View File

@ -37,7 +37,7 @@ index 620f507..1558c4e 100644
if (!pp) if (!pp)
@@ -322,8 +325,10 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp, @@ -322,8 +325,10 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
WWID_SIZE - 1); WWID_SIZE);
} }
/* Only call this in multipath client mode */ /* Only call this in multipath client mode */
- if (!is_daemon && store_path(pathvec, pp)) - if (!is_daemon && store_path(pathvec, pp))

View File

@ -1,34 +0,0 @@
From 8f9ac30dcb144d4ce79f88e8a01fba0968da3a07 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:03 -0500
Subject: [PATCH] libmultipath: fix set_int error path
set_int() wasn't checking if the line actually had a value before
converting it to an integer. Found by coverity. Also, it should
be using set_value().
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dict.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 32524d5f..bf4701ee 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -33,7 +33,10 @@ set_int(vector strvec, void *ptr)
int *int_ptr = (int *)ptr;
char * buff;
- buff = VECTOR_SLOT(strvec, 1);
+ buff = set_value(strvec);
+ if (!buff)
+ return 1;
+
*int_ptr = atoi(buff);
return 0;
--
2.11.0

View File

@ -1,28 +0,0 @@
From 5e71f6eb17cbb119f0f995f234bf1887a4f77058 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 11 Oct 2018 15:43:47 -0500
Subject: [PATCH] libmultipath: free allocated value in set_int
set_int() needs to free the buffer it got back from set_value()
Fixes: 8f9ac30d ("libmultipath: fix set_int error path")
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/dict.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index bf4701ee..c3f5a6e6 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -39,6 +39,7 @@ set_int(vector strvec, void *ptr)
*int_ptr = atoi(buff);
+ FREE(buff);
return 0;
}
--
2.11.0

View File

@ -1,32 +0,0 @@
From c3b739527258dae7ebe4b5d083a33ce527675082 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:07 -0500
Subject: [PATCH] libmultipath: fix memory issue in path_latency prio
The path_latency prioriziter was assuming that prepare_directio_read()
always succeeds. However, it doesn't, and when it fails, the prioritizer
used buf without it pointing to alloced memory. Found by coverity.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/prioritizers/path_latency.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libmultipath/prioritizers/path_latency.c b/libmultipath/prioritizers/path_latency.c
index 765265c0..eeee01e1 100644
--- a/libmultipath/prioritizers/path_latency.c
+++ b/libmultipath/prioritizers/path_latency.c
@@ -237,7 +237,8 @@ int getprio(struct path *pp, char *args, unsigned int timeout)
lg_maxavglatency = log(MAX_AVG_LATENCY) / lg_base;
lg_minavglatency = log(MIN_AVG_LATENCY) / lg_base;
- prepare_directio_read(pp->fd, &blksize, &buf, &restore_flags);
+ if (prepare_directio_read(pp->fd, &blksize, &buf, &restore_flags) < 0)
+ return PRIO_UNDEF;
temp = io_num;
while (temp-- > 0) {
--
2.11.0

View File

@ -1,31 +0,0 @@
From 156b75082c7c5d5aa832e500cf4175c3f943fa22 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:08 -0500
Subject: [PATCH] libmultipath: fix null dereference int alloc_path_group
If all_pathgroup failed to allocate a vector for pgp->paths, instead of
failing after it freed pgp, it would set pgp to NULL and then
dereference it. This patch fixes that. Found by coverity.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index ae847d61..caa178a6 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -165,7 +165,7 @@ alloc_pathgroup (void)
if (!pgp->paths) {
FREE(pgp);
- pgp = NULL;
+ return NULL;
}
dm_pathgroup_to_gen(pgp)->ops = &dm_gen_pathgroup_ops;
--
2.11.0

View File

@ -1,31 +0,0 @@
From b25493d8fa13c2d7a346e0b18ad4756aa733ff8d Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:10 -0500
Subject: [PATCH] multipath: fix max array size in print_cmd_valid
The code is attempting to verify that 0 <= k < 3
However, sizeof(val) is 12, assuming 4 byte integers. The check needs to
take integer size into account. Found by coverity.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipath/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/multipath/main.c b/multipath/main.c
index fc5bf169..d5aad952 100644
--- a/multipath/main.c
+++ b/multipath/main.c
@@ -482,7 +482,7 @@ static int print_cmd_valid(int k, const vector pathvec,
struct timespec until;
struct path *pp;
- if (k < 0 || k >= sizeof(vals))
+ if (k < 0 || k >= (sizeof(vals) / sizeof(int)))
return 1;
if (k == 2) {
--
2.11.0

View File

@ -1,41 +0,0 @@
From b31f8f5a21a90fb9087c02e00b6b69934a5bbdd5 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:12 -0500
Subject: [PATCH] multipathd: minor fixes
In update_multipath(), conf is set again in a couple of lines, and
nothing uses it before then, so there's no point in setting it twice.
Also, in ev_remove_path(), strncpy() could end up unterminated, so
use strlcpy() instead.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index ba796ab1..cd963043 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -429,7 +429,7 @@ int update_multipath (struct vectors *vecs, char *mapname, int reset)
continue;
if (pp->state != PATH_DOWN) {
- struct config *conf = get_multipath_config();
+ struct config *conf;
int oldstate = pp->state;
int checkint;
@@ -1097,7 +1097,7 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
/*
* flush_map will fail if the device is open
*/
- strncpy(alias, mpp->alias, WWID_SIZE);
+ strlcpy(alias, mpp->alias, WWID_SIZE);
if (mpp->flush_on_last_del == FLUSH_ENABLED) {
condlog(2, "%s Last path deleted, disabling queueing", mpp->alias);
mpp->retry_tick = 0;
--
2.11.0

View File

@ -1,68 +0,0 @@
From 3b8da487d534eb49c8c59d1a9c2d6199c0716572 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Tue, 9 Oct 2018 18:03:14 -0500
Subject: [PATCH] multipathd: fix memory leak on error in configure
If configure fails after allocing mpvec, it must free it. Found by
coverity.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/main.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/multipathd/main.c b/multipathd/main.c
index 463b1b82..04dce04c 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -2278,7 +2278,7 @@ configure (struct vectors * vecs)
ret = path_discovery(vecs->pathvec, DI_ALL);
if (ret < 0) {
condlog(0, "configure failed at path discovery");
- return 1;
+ goto fail;
}
vector_foreach_slot (vecs->pathvec, pp, i){
@@ -2295,7 +2295,7 @@ configure (struct vectors * vecs)
}
if (map_discovery(vecs)) {
condlog(0, "configure failed at map discovery");
- return 1;
+ goto fail;
}
/*
@@ -2309,7 +2309,7 @@ configure (struct vectors * vecs)
force_reload = FORCE_RELOAD_YES;
if (ret) {
condlog(0, "configure failed while coalescing paths");
- return 1;
+ goto fail;
}
/*
@@ -2318,7 +2318,7 @@ configure (struct vectors * vecs)
*/
if (coalesce_maps(vecs, mpvec)) {
condlog(0, "configure failed while coalescing maps");
- return 1;
+ goto fail;
}
dm_lib_release();
@@ -2354,6 +2354,10 @@ configure (struct vectors * vecs)
i--;
}
return 0;
+
+fail:
+ vector_free(mpvec);
+ return 1;
}
int
--
2.11.0

View File

@ -1,32 +0,0 @@
From e7a3324274578d63cdef23bb08410df20e0de862 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 10 Oct 2018 13:01:09 -0500
Subject: [PATCH] multipathd: check for NULL udevice in cli_add_path
If cli_add_path can't get a udevice for the path, it should fail
immediately, instead of continuing with a NULL udevice, since it will
fail in store_pathinfo() anyway.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli_handlers.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index bb164726..75000807 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -720,6 +720,10 @@ cli_add_path (void * v, char ** reply, int * len, void * data)
udevice = udev_device_new_from_subsystem_sysname(udev,
"block",
param);
+ if (!udevice) {
+ condlog(0, "%s: can't find path", param);
+ return 1;
+ }
conf = get_multipath_config();
pthread_cleanup_push(put_multipath_config, conf);
r = store_pathinfo(vecs->pathvec, conf,
--
2.11.0

View File

@ -1,28 +0,0 @@
From 2578838d077ecd7f4555e90df019053e7131e151 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 8 Jan 2019 23:54:00 +0100
Subject: [PATCH] kpartx(coverity): fix apparent out-of-bounds access
This was a false positive.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
kpartx/dasd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kpartx/dasd.c b/kpartx/dasd.c
index fb358add..61b609a5 100644
--- a/kpartx/dasd.c
+++ b/kpartx/dasd.c
@@ -190,7 +190,7 @@ read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
memcpy (&vlabel, data, sizeof(vlabel));
else {
bzero(&vlabel,4);
- memcpy (&vlabel.vollbl, data, sizeof(vlabel) - 4);
+ memcpy ((char *)&vlabel + 4, data, sizeof(vlabel) - 4);
}
vtoc_ebcdic_dec(vlabel.vollbl, type, 4);
--
2.11.0

View File

@ -1,28 +0,0 @@
From 7d30130a5d53629e7c3420aa58018c75fa9dbeef Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 8 Jan 2019 23:54:02 +0100
Subject: [PATCH] libmultipath(coverity): fix apparent overflow
"preferred_path" contains always "0" or "1".
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 7f983a63..3fd79a36 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -520,7 +520,7 @@ sysfs_get_asymmetric_access_state(struct path *pp, char *buff, int buflen)
/* Parse error, ignore */
return 0;
}
- return preferred;
+ return !!preferred;
}
static void
--
2.11.0

View File

@ -1,27 +0,0 @@
From 3044fc0bd953faf71bfa6ebd98f2084f6ae1772b Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 8 Jan 2019 23:54:04 +0100
Subject: [PATCH] libmultipath(coverity): fix int overflow in
sysfs_set_scsi_tmo
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 3fd79a36..1748eebb 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -711,7 +711,7 @@ sysfs_set_scsi_tmo (struct multipath *mpp, int checkint)
int dev_loss_tmo = mpp->dev_loss;
if (mpp->no_path_retry > 0) {
- uint64_t no_path_retry_tmo = mpp->no_path_retry * checkint;
+ uint64_t no_path_retry_tmo = (uint64_t)mpp->no_path_retry * checkint;
if (no_path_retry_tmo > MAX_DEV_LOSS_TMO)
no_path_retry_tmo = MAX_DEV_LOSS_TMO;
--
2.11.0

View File

@ -1,26 +0,0 @@
From fb87e6e9d5778c9b2874496ff6e44c0001a3c228 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 8 Jan 2019 23:54:05 +0100
Subject: [PATCH] libmultipath(coverity): fix "enum misuse" for find_multipaths
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/dict.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index fd29abca..eaad4f18 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -327,7 +327,7 @@ def_find_multipaths_handler(struct config *conf, vector strvec)
int i;
if (set_yes_no_undef(strvec, &conf->find_multipaths) == 0 &&
- conf->find_multipaths != YNU_UNDEF)
+ conf->find_multipaths != FIND_MULTIPATHS_UNDEF)
return 0;
buff = set_value(strvec);
--
2.11.0

View File

@ -1,28 +0,0 @@
From 7ec04256a56709963e8b954fc6036ca6ba1db137 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Tue, 8 Jan 2019 23:54:09 +0100
Subject: [PATCH] libmultipath(coverity): fix possible NULL dereference
coverity warns that recv_packet may set reply to NULL.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/configure.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 39d2a956..af4d78de 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1041,7 +1041,7 @@ int check_daemon(void)
if (recv_packet(fd, &reply, timeout) != 0)
goto out;
- if (strstr(reply, "shutdown"))
+ if (reply && strstr(reply, "shutdown"))
goto out_free;
ret = 1;
--
2.11.0

View File

@ -1,91 +0,0 @@
From a10343b550f56c6c39c6a9b8f9ad38ab825a3fa3 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 22 Mar 2019 19:58:56 +0800
Subject: [PATCH 3/5] libmultipath: fix memory leaks from scandir() use
upstream commit b0e8a7456dd83cd0a5ecd1005e016656e785405f
scandir() users must not only free the resulting dirent* array,
but also every member. Add a cleanup function, and fix the
existing users of scandir() in libmultipath.
Add a small helper macro for casting function pointers to the
type pthread_cleanup_push() expects.
---
libmultipath/config.c | 10 ++++------
libmultipath/util.c | 9 +++++++++
libmultipath/util.h | 8 ++++++++
3 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index bfd07e3..654f330 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -640,17 +640,13 @@ free_config (struct config * conf)
FREE(conf);
}
-static void free_namelist(void *nl)
-{
- free(nl);
-}
-
/* if multipath fails to process the config directory, it should continue,
* with just a warning message */
static void
process_config_dir(struct config *conf, vector keywords, char *dir)
{
struct dirent **namelist;
+ struct scandir_result sr;
int i, n;
char path[LINE_MAX];
int old_hwtable_size;
@@ -670,7 +666,9 @@ process_config_dir(struct config *conf, vector keywords, char *dir)
return;
} else if (n == 0)
return;
- pthread_cleanup_push(free_namelist, namelist);
+ sr.di = namelist;
+ sr.n = n;
+ pthread_cleanup_push_cast(free_scandir_result, &sr);
for (i = 0; i < n; i++) {
if (!strstr(namelist[i]->d_name, ".conf"))
continue;
diff --git a/libmultipath/util.c b/libmultipath/util.c
index 3c284b7..2bb1102 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -472,3 +472,12 @@ int safe_write(int fd, const void *buf, size_t count)
return 0;
}
+
+void free_scandir_result(struct scandir_result *res)
+{
+ int i;
+
+ for (i = 0; i < res->n; i++)
+ FREE(res->di[i]);
+ FREE(res->di);
+}
diff --git a/libmultipath/util.h b/libmultipath/util.h
index 56cec76..4374720 100644
--- a/libmultipath/util.h
+++ b/libmultipath/util.h
@@ -28,5 +28,13 @@ int safe_write(int fd, const void *buf, size_t count);
snprintf(var, sizeof(var), format, ##args) >= sizeof(var)
#define safe_snprintf(var, size, format, args...) \
snprintf(var, size, format, ##args) >= size
+#define pthread_cleanup_push_cast(f, arg) \
+ pthread_cleanup_push(((void (*)(void *))&f), (arg))
+
+struct scandir_result {
+ struct dirent **di;
+ int n;
+};
+void free_scandir_result(struct scandir_result *);
#endif /* _UTIL_H */
--
2.19.1

View File

@ -1,109 +0,0 @@
multipathd: fix mpp->hwe handling when paths are freed
Commit 1f962693 didn't deal with all of cases where a path that was part
of a multipath device could be removed. verify_paths() removes any path
that no longer exists in sysfs. mpp->hwe needs to be updated here as
well, since verify_paths() could remove the path whose hwe vector is
pointed to by mpp->hwe. Also, now that extract_hwe_from_path() is
called in verify_paths(), the extract_hwe_from_path() calls that
happened immediately after verify_paths() can be dropped.
The other part of this fix is mostly cosmetic. In ev_add_path(), if
domap() fails after the path is added to the multipath device and
verify_paths() is called, the code can loop back to the rescan label. If
the size of the path or the multipath device changed in the interim,
ev_add_path() would remove the path, without updating mpp->hwe; but
there is no way for the size to change. Just to make that clearer in the
code, I've moved the size check to before the rescan label so it only
happens once.
Fixes: 1f962693 "multipathd: fix mpp->hwe handling on path removal"
Cc: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/structs_vec.c | 7 +++++++
multipathd/main.c | 22 ++++++++--------------
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 828aef2..2808efe 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -418,6 +418,12 @@ int verify_paths(struct multipath *mpp, struct vectors *vecs)
vector_del_slot(mpp->paths, i);
i--;
+ /* Make sure mpp->hwe doesn't point to freed memory.
+ * We call extract_hwe_from_path() below to restore
+ * mpp->hwe
+ */
+ if (mpp->hwe == pp->hwe)
+ mpp->hwe = NULL;
if ((j = find_slot(vecs->pathvec,
(void *)pp)) != -1)
vector_del_slot(vecs->pathvec, j);
@@ -427,6 +433,7 @@ int verify_paths(struct multipath *mpp, struct vectors *vecs)
mpp->alias, pp->dev, pp->dev_t);
}
}
+ extract_hwe_from_path(mpp);
return count;
}
diff --git a/multipathd/main.c b/multipathd/main.c
index 8de0871..872843c 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -472,7 +472,6 @@ retry:
verify_paths(mpp, vecs);
mpp->action = ACT_RELOAD;
- extract_hwe_from_path(mpp);
if (setup_map(mpp, params, PARAMS_SIZE, vecs)) {
condlog(0, "%s: failed to setup new map in update", mpp->alias);
retries = -1;
@@ -948,6 +947,14 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
goto fail; /* leave path added to pathvec */
}
mpp = find_mp_by_wwid(vecs->mpvec, pp->wwid);
+ if (mpp && pp->size && mpp->size != pp->size) {
+ condlog(0, "%s: failed to add new path %s, device size mismatch", mpp->alias, pp->dev);
+ int i = find_slot(vecs->pathvec, (void *)pp);
+ if (i != -1)
+ vector_del_slot(vecs->pathvec, i);
+ free_path(pp);
+ return 1;
+ }
if (mpp && mpp->wait_for_udev &&
(pathcount(mpp, PATH_UP) > 0 ||
(pathcount(mpp, PATH_GHOST) > 0 && pp->tpgs != TPGS_IMPLICIT &&
@@ -962,18 +969,6 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
pp->mpp = mpp;
rescan:
if (mpp) {
- if (pp->size && mpp->size != pp->size) {
- condlog(0, "%s: failed to add new path %s, "
- "device size mismatch",
- mpp->alias, pp->dev);
- int i = find_slot(vecs->pathvec, (void *)pp);
- if (i != -1)
- vector_del_slot(vecs->pathvec, i);
- clear_ref_from_mpp(pp, vecs);
- free_path(pp);
- return 1;
- }
-
condlog(4,"%s: adopting all paths for path %s",
mpp->alias, pp->dev);
if (adopt_paths(vecs->pathvec, mpp))
@@ -981,7 +976,6 @@ rescan:
verify_paths(mpp, vecs);
mpp->action = ACT_RELOAD;
- extract_hwe_from_path(mpp);
} else {
if (!should_multipath(pp, vecs->pathvec, vecs->mpvec)) {
orphan_path(pp, "only one path");
--
2.19.1

View File

@ -1,29 +0,0 @@
Subject: [PATCH] check close return value
---
mpathpersist/main.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/mpathpersist/main.c b/mpathpersist/main.c
index 4db07b2..db8b6d7 100644
--- a/mpathpersist/main.c
+++ b/mpathpersist/main.c
@@ -498,7 +498,14 @@ int main (int argc, char * argv[])
out :
if (fd >= 0)
- close(fd);
+ {
+ res = close(fd);
+ if (res < 0)
+ {
+ ret = MPATH_PR_FILE_ERROR;
+ }
+
+ }
mpath_lib_exit(conf);
udev_unref(udev);
return (ret >= 0) ? ret : MPATH_PR_OTHER;
--
2.19.1

View File

@ -1,74 +0,0 @@
author Benjamin Marzinski <bmarzins@redhat.com>
Sat, 30 Mar 2019 14:05:56 +0800 (01:05 -0500)
committer Christophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 18 Apr 2019 19:03:34 +0800 (13:03 +0200)
commit 3ad48a0bc002f3d1b2a27eafecfd7fbb390bfb94
multipathd: ignore failed wwid recheck
If disable_changed_wwids is set, when multipathd gets a change event on
a path, it verifies that the wwid hasn't changed in uev_update_path().
If get_uid() failed, uev_update_path treated this as a wwid change to 0.
This could cause paths to suddenly be dropped due to an issue with
getting the wwid. Even if get_uid() failed because the path was down,
it no change uevent happend when it later became active, multipathd
would continue to ignore the path. Also, scsi_uid_fallback() clears the
failure return if it doesn't attempt to fallback, causing get_uid()
to return success, when it actually failed.
Multipathd should neither set nor clear wwid_changed if get_uid()
returned failure. Also, scsi_uid_fallback() should retain the old return
value if it doesn't attempt to fallback.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 6 +++---
multipathd/main.c | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 1369f38..a852843 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1862,9 +1862,9 @@ get_vpd_uid(struct path * pp)
}
static ssize_t scsi_uid_fallback(struct path *pp, int path_state,
- const char **origin)
+ const char **origin, ssize_t old_len)
{
- ssize_t len = 0;
+ ssize_t len = old_len;
int retrigger;
struct config *conf;
@@ -1935,7 +1935,7 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev)
origin = "sysfs";
}
if (len <= 0 && pp->bus == SYSFS_BUS_SCSI)
- len = scsi_uid_fallback(pp, path_state, &origin);
+ len = scsi_uid_fallback(pp, path_state, &origin, len);
}
if ( len < 0 ) {
condlog(1, "%s: failed to get %s uid: %s",
diff --git a/multipathd/main.c b/multipathd/main.c
index 872843c..49d1469 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1246,9 +1246,11 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
char wwid[WWID_SIZE];
strcpy(wwid, pp->wwid);
- get_uid(pp, pp->state, uev->udev);
+ rc = get_uid(pp, pp->state, uev->udev);
- if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) {
+ if (rc != 0)
+ strcpy(pp->wwid, wwid);
+ else if (strncmp(wwid, pp->wwid, WWID_SIZE) != 0) {
condlog(0, "%s: path wwid changed from '%s' to '%s'. %s",
uev->kernel, wwid, pp->wwid,
(disable_changed_wwids ? "disallowing" :
--
2.19.1

View File

@ -1,30 +0,0 @@
From a358e60548ddb4631ed1b4ea404f71e1ea8f57e5 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Thu, 11 Apr 2019 12:49:20 +0200
Subject: [PATCH 1/8] libmultipath: group_by_prio: fix signedness bug
pp->priority can be negative, so we we shouldn't compare
it with an unsigned int.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/pgpolicies.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/pgpolicies.c b/libmultipath/pgpolicies.c
index ac2596a..660768a 100644
--- a/libmultipath/pgpolicies.c
+++ b/libmultipath/pgpolicies.c
@@ -312,7 +312,7 @@ out:
int group_by_prio(struct multipath *mp)
{
int i;
- unsigned int prio;
+ int prio;
struct path * pp;
struct pathgroup * pgp;
vector pathvec = NULL;
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From dc8b964a03a547eb8dc62b317f9f168a35943ebf Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 17 May 2019 11:14:10 -0500
Subject: [PATCH 2/8] multipathd: handle NULL return from genhelp_handler
parse_cmd() wasn't checking if genhelp_handler() returned NULL. It was simply
assuming that it got a string. On NULL, it now returns an error. Found by
Coverity.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
multipathd/cli.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/multipathd/cli.c b/multipathd/cli.c
index a75afe3..ff17a5b 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -465,6 +465,8 @@ parse_cmd (char * cmd, char ** reply, int * len, void * data, int timeout )
if (r) {
*reply = genhelp_handler(cmd, r);
+ if (*reply == NULL)
+ return EINVAL;
*len = strlen(*reply) + 1;
return 0;
}
@@ -472,9 +474,11 @@ parse_cmd (char * cmd, char ** reply, int * len, void * data, int timeout )
h = find_handler(fingerprint(cmdvec));
if (!h || !h->fn) {
+ free_keys(cmdvec);
*reply = genhelp_handler(cmd, EINVAL);
+ if (*reply == NULL)
+ return EINVAL;
*len = strlen(*reply) + 1;
- free_keys(cmdvec);
return 0;
}
--
1.8.3.1

View File

@ -1,50 +0,0 @@
From 552bcf2f6245cbce4326455e28ab7c1160871978 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 24 Jun 2019 11:27:40 +0200
Subject: [PATCH 3/8] libmultipath: fix parsing of VPD 83 type 1 (T10 vendor
ID)
In the buffer overflow case, the code would set p_len = out_len - len - 2,
then len = len + plen = out_len - 2, and check if len >= out_len - 1,
which is never the case. Rather, set p_len = out_len - len -1, and
check the length again before appending the underscore.
Fixes: 18176202e75c "Read wwid from sysfs vpg_pg83 attribute"
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a852843..9e99d9d 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1151,8 +1151,11 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
p = vpd;
while ((p = memchr(vpd, ' ', vpd_len))) {
p_len = p - vpd;
- if (len + p_len > out_len - 1)
- p_len = out_len - len - 2;
+ if (len + p_len > out_len - 1) {
+ condlog(1, "%s: WWID overflow, type 1, %d/%lu bytes required",
+ __func__, len + p_len, out_len);
+ p_len = out_len - len - 1;
+ }
memcpy(out + len, vpd, p_len);
len += p_len;
if (len >= out_len - 1) {
@@ -1161,6 +1164,10 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
}
out[len] = '_';
len ++;
+ if (len >= out_len - 1) {
+ out[len] = '\0';
+ break;
+ }
vpd = p;
vpd_len -= p_len;
while (vpd && *vpd == ' ') {
--
1.8.3.1

View File

@ -1,31 +0,0 @@
From c00ee906582b87aeced4b2fb0caa011edb5cbc17 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 24 Jun 2019 11:27:41 +0200
Subject: [PATCH 4/8] libmultipath: Fix buffer overflow in parse_vpd_pg80()
We set out[len] = '\0' later, thus we should set len to no more then
out_len - 1.
Fixes: 756ef73b7197 "Separate out vpd parsing functions"
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 9e99d9d..416823b 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -999,7 +999,7 @@ parse_vpd_pg80(const unsigned char *in, char *out, size_t out_len)
if (len >= out_len) {
condlog(2, "vpd pg80 overflow, %d/%d bytes required",
len, (int)out_len);
- len = out_len;
+ len = out_len - 1;
}
if (len > 0) {
memcpy(out, in + 4, len);
--
1.8.3.1

View File

@ -1,31 +0,0 @@
From f39a97d2972e3959985c2771f1fc53c45897acfb Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 24 Jun 2019 11:27:43 +0200
Subject: [PATCH 5/8] libmultipath: fix another WWID overflow in
parse_vpd_pg83()
This one is an obvious typo.
Fixes: 18176202e75c "Read wwid from sysfs vpg_pg83 attribute"
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 416823b..c57369c 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1136,7 +1136,7 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
len = 1;
vpd += 4;
vpd_len -= 4;
- if (vpd_len > out_len + 2)
+ if (vpd_len > out_len - 2)
vpd_len = out_len - 2;
memcpy(out, vpd, vpd_len);
len = vpd_len + 1;
--
1.8.3.1

View File

@ -1,66 +0,0 @@
From e8a63834f966cc605429c5b2ab3edc79a46c3bff Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 24 Jun 2019 11:27:42 +0200
Subject: [PATCH 6/8] libmultipath: fix possible WWID overflow in
parse_vpd_pg83()
We have to check the remaining length before printing to the
output buffer, not afterwards.
Fixes: 18176202e75c "Read wwid from sysfs vpg_pg83 attribute"
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index c57369c..34d425b 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1098,11 +1098,9 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
int i;
len = sprintf(out, "%d", vpd_type);
- for (i = 0; i < vpd_len; i++) {
+ for (i = 0; i < vpd_len && len < out_len - 2; i++) {
len += sprintf(out + len,
"%02x", vpd[i]);
- if (len >= out_len)
- break;
}
} else if (vpd_type == 0x8) {
if (!memcmp("eui.", vpd, 4)) {
@@ -1110,27 +1108,19 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
len = 1;
vpd += 4;
vpd_len -= 4;
- for (i = 0; i < vpd_len; i++) {
+ for (i = 0; i < vpd_len && len < out_len - 1; i++) {
len += sprintf(out + len, "%c",
tolower(vpd[i]));
- if (len >= out_len)
- break;
}
- len = vpd_len + 1;
- out[len] = '\0';
} else if (!memcmp("naa.", vpd, 4)) {
out[0] = '3';
len = 1;
vpd += 4;
vpd_len -= 4;
- for (i = 0; i < vpd_len; i++) {
+ for (i = 0; i < vpd_len && len < out_len - 1; i++) {
len += sprintf(out + len, "%c",
tolower(vpd[i]));
- if (len >= out_len)
- break;
}
- len = vpd_len + 1;
- out[len] = '\0';
} else {
out[0] = '8';
len = 1;
--
1.8.3.1

View File

@ -1,34 +0,0 @@
From 02748f3907fc95fbbf368ffda4ffb4bbf60f948d Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 24 Jun 2019 11:27:44 +0200
Subject: [PATCH 7/8] libmultipath: fix parsing of SCSI name string, iqn format
Do not overwrite the leading '8'.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/discovery.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 34d425b..a4769ee 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1123,12 +1123,11 @@ parse_vpd_pg83(const unsigned char *in, size_t in_len,
}
} else {
out[0] = '8';
- len = 1;
vpd += 4;
vpd_len -= 4;
if (vpd_len > out_len - 2)
vpd_len = out_len - 2;
- memcpy(out, vpd, vpd_len);
+ memcpy(out + 1, vpd, vpd_len);
len = vpd_len + 1;
out[len] = '\0';
}
--
1.8.3.1

View File

@ -1,81 +0,0 @@
From 27039be7cfd551646425b0ebc43a87e86484c370 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 23 Aug 2019 12:48:50 -0500
Subject: [PATCH 8/8] libmultipath: fix double free in pgpolicyfn error paths
In the pgpolicy functions, if an error is encountered after
alloc_pathgroup() is called, but before the path group is added to a
multipath device with add_pathgroup(), the pathgroup needs to be cleaned
up by calling free_pathgroup(). However, after the pathgroup has been
added to the multipath device, calling free_pgvec() will clean it up. In
this case, if free_pathgroup() is called first, the recently added
pathgroup will be freed twice.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/pgpolicies.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libmultipath/pgpolicies.c b/libmultipath/pgpolicies.c
index 660768a..9acf46a 100644
--- a/libmultipath/pgpolicies.c
+++ b/libmultipath/pgpolicies.c
@@ -125,7 +125,7 @@ int group_by_node_name(struct multipath * mp)
/* feed the first path */
if (store_path(pgp->paths, pp))
- goto out2;
+ goto out1;
bitmap[i] = 1;
@@ -139,7 +139,7 @@ int group_by_node_name(struct multipath * mp)
if (!strncmp(pp->tgt_node_name, pp2->tgt_node_name,
NODE_NAME_SIZE)) {
if (store_path(pgp->paths, pp2))
- goto out2;
+ goto out1;
bitmap[j] = 1;
}
@@ -201,7 +201,7 @@ int group_by_serial(struct multipath * mp)
/* feed the first path */
if (store_path(pgp->paths, pp))
- goto out2;
+ goto out1;
bitmap[i] = 1;
@@ -214,7 +214,7 @@ int group_by_serial(struct multipath * mp)
if (0 == strcmp(pp->serial, pp2->serial)) {
if (store_path(pgp->paths, pp2))
- goto out2;
+ goto out1;
bitmap[j] = 1;
}
@@ -258,7 +258,7 @@ int one_path_per_group(struct multipath *mp)
goto out1;
if (store_path(pgp->paths, pp))
- goto out1;
+ goto out;
}
sort_pathgroups(mp);
free_pathvec(mp->paths, KEEP_PATHS);
@@ -379,7 +379,7 @@ int group_by_prio(struct multipath *mp)
vector_foreach_slot(pathvec, pp, i) {
if (pp->priority == prio) {
if (store_path(pgp->paths, pp))
- goto out2;
+ goto out1;
vector_del_slot(pathvec, i);
i--;
--
1.8.3.1

View File

@ -1,41 +0,0 @@
From dbd6e0f8ad3d145c73175a6f99eab401408d9d54 Mon Sep 17 00:00:00 2001
From: Enzo Matsumiya <ematsumiya@suse.de>
Date: Fri, 7 Feb 2020 11:45:25 -0300
Subject: [PATCH] libmultipath: fix files read from config_dir
If config_dir contains a file named, for example, "some.conf.backup", this file
will still be loaded by multipath because process_config_dir()
(libmultipath/config.c) uses strstr() to check for the ".conf" extension, but
that doesn't guarantee that ".conf" is at the end of the filename.
This patch will make sure that only files ending in ".conf" are loaded from
config_dir.
This is to comply with config_dir entry description in man 5 multipath.conf.
Signed-off-by: Enzo Matsumiya <ematsumiya@suse.de>
---
libmultipath/config.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index 5af7af5..7c641a3 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -669,8 +669,11 @@ process_config_dir(struct config *conf, vector keywords, char *dir)
sr.n = n;
pthread_cleanup_push_cast(free_scandir_result, &sr);
for (i = 0; i < n; i++) {
- if (!strstr(namelist[i]->d_name, ".conf"))
+ char *ext = strrchr(namelist[i]->d_name, '.');
+
+ if (!ext || strcmp(ext, ".conf"))
continue;
+
old_hwtable_size = VECTOR_SIZE(conf->hwtable);
snprintf(path, LINE_MAX, "%s/%s", dir, namelist[i]->d_name);
path[LINE_MAX-1] = '\0';
--
1.8.3.1

View File

@ -1,50 +0,0 @@
From b3d65f57bc63ccfc52b89adb7ab7c0bc659c00af Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 19 Feb 2020 00:48:29 -0600
Subject: [PATCH] libmultipath: fix sgio_get_vpd looping
If do_inq returns a page with a length that is less than maxlen, but
larger than DEFAULT_SGIO_LEN, this function will loop forever. Also
if do_inq returns with a length equal to or greater than maxlen,
sgio_get_vpd will exit immediately, even if it hasn't read the entire
page. Fix these issues, modify the tests to verify the new behavior.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index a4769ee..400959d 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -956,6 +956,7 @@ static int
sgio_get_vpd (unsigned char * buff, int maxlen, int fd, int pg)
{
int len = DEFAULT_SGIO_LEN;
+ int rlen;
if (fd < 0) {
errno = EBADF;
@@ -963,12 +964,11 @@ sgio_get_vpd (unsigned char * buff, int maxlen, int fd, int pg)
}
retry:
if (0 == do_inq(fd, 0, 1, pg, buff, len)) {
- len = get_unaligned_be16(&buff[2]) + 4;
- if (len >= maxlen)
- return len;
- if (len > DEFAULT_SGIO_LEN)
- goto retry;
- return len;
+ rlen = get_unaligned_be16(&buff[2]) + 4;
+ if (rlen <= len || len >= maxlen)
+ return rlen;
+ len = (rlen < maxlen)? rlen : maxlen;
+ goto retry;
}
return -1;
}
--
1.8.3.1

BIN
multipath-tools-d491591.tgz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,72 +1,34 @@
Name: multipath-tools Name: multipath-tools
Version: 0.7.7 Version: 0.8.4
Release: 20 Release: 1
Summary: Tools to manage multipath devices with the device-mapper Summary: Tools to manage multipath devices with the device-mapper
License: GPLv2-or-later and LGPLv2+ License: GPLv2-or-later and LGPLv2+
URL: http://christophe.varoqui.free.fr/ URL: http://christophe.varoqui.free.fr/
# curl "https://git.opensvc.com/?p=multipath-tools/.git;a=snapshot;h=ef6d98b;sf=tgz" -o multipath-tools-ef6d98b.tgz # curl "https://git.opensvc.com/gitweb.cgi?p=multipath-tools/.git;a=snapshot;h=d4915917655b3d205aa0e339ca13080ed8182d0d;sf=tgz" -o multipath-tools-d491591.tgz
Source0: multipath-tools-ef6d98b.tgz Source0: multipath-tools-d491591.tgz
Source1: multipath.conf Source1: multipath.conf
Patch0: 0000-libmultipath-remove-last-of-rbd-code.patch Patch1: 0001-change-order-of-multipath.rules.patch
Patch1: 0001-libmultipath-fix-detect-alua-corner-case.patch Patch2: 0002-libmpathpersist-depend-on-libmultipath.patch
Patch2: 0002-multipath-fix-setting-conf-version.patch Patch3: 0003-libmultipath-assign-variable-to-make-gcc-happy.patch
Patch3: 0003-mpathpersist-add-param-alltgpt-option.patch Patch4: 0004-RH-add-mpathconf.patch
Patch4: 0004-libmutipath-remove-unused-IDE-bus-type.patch Patch5: 0005-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch5: 0005-multipathd-add-new-protocol-path-wildcard.patch Patch6: 0006-fix-syntax-error.patch
Patch6: 0006-libmultipath-add-protocol-blacklist-option.patch Patch7: 0007-fix-multipathd-resize-when-not-all-paths-size-are-equal.patch
Patch7: 0007-libmultipath-remove-_filter_-blacklist-functions.patch Patch8: 0008-multipathd-disable-queueing-for-recreated-map-in-uev.patch
Patch8: 0008-multipath-tests-change-to-work-with-old-make-version.patch Patch9: 0009-avoid-handling-paths-repeatedly-in-coalesce-paths.patch
Patch9: 0009-multipath-tests-add-blacklist-tests.patch Patch10: 0010-fix-bugs-backported-from-next-branch.patch
Patch10: 0010-mpathpersist-add-missing-param-rk-usage-info.patch Patch11: 0011-bugfix-fix-change-reservation-key-to-uint8-for-memcmp.patch
Patch11: 0011-change-order-of-multipath.rules.patch Patch12: 0012-bugfix-ignore-for-clear-mismatch-key.patch
Patch12: 0012-RH-Remove-the-property-blacklist-exception-builtin.patch Patch13: 0013-bugfix-flush-and-sync-before-reboot.patch
Patch13: 0013-RH-add-mpathconf.patch Patch14: 0014-bugfix-RH-remove-local-disk-from-pathvec.patch
Patch14: 0014-fix-segfault-when-mount-or-umount-VIMS-with-reservation-conflict.patch Patch15: 0015-bugfix-lun-expansion-failure-when-there-is-offline-path.patch
Patch15: 0015-fix-multipathd-resize-when-not-all-paths-size-are-equal.patch Patch16: 0016-bugfix-some-memory-leaks-issues-in-libmpathpersist.patch
Patch16: 0016-multipathd-disable-queueing-for-recreated-map-in-uev.patch Patch17: 0017-bugfix-change-log-level-to-info-if-alua-is-not-support-by-s.patch
Patch17: 0017-avoid-handling-paths-repeatedly-in-coalesce-paths.patch Patch18: 0018-bugfix-clear-mpp-path-reference-when-path-is-freed-otherwis.patch
Patch18: 0018-fix-bugs-backported-from-next-branch.patch Patch19: 0019-bugfix-libmultipath-fix-memory-leak-in-disassemble_map.patch
Patch19: 0019-bugfix-fix-change-reservation-key-to-uint8-for-memcmp.patch Patch20: 0020-fix-find-multipath-failure.patch
Patch20: 0020-bugfix-ignore-for-clear-mismatch-key.patch Patch21: 0021-change-kpartx-file-and-default-bindir.patch
Patch21: 0021-bugfix-flush-and-sync-before-reboot.patch
Patch22: 0022-bugfix-RH-remove-local-disk-from-pathvec.patch
Patch23: 0023-bugfix-lun-expansion-failure-when-there-is-offline-path.patch
Patch24: 0024-bugfix-some-memory-leaks-issues-in-libmpathpersist.patch
Patch25: 0025-libmultipath-fix-set_int-error-path.patch
Patch26: 0026-libmultipath-free-allocated-value-in-set_int.patch
Patch27: 0027-libmultipath-fix-memory-issue-in-path_latency-prio.patch
Patch28: 0028-libmultipath-fix-null-dereference-int-alloc_path_group.patch
Patch29: 0029-multipath-fix-max-array-size-in-print_cmd_valid.patch
Patch30: 0030-multipathd-minor-fixes.patch
Patch31: 0031-multipathd-fix-memory-leak-on-error-in-configure.patch
Patch32: 0032-multipathd-check-for-NULL-udevice-in-cli_add_path.patch
Patch33: 0033-kpartx-fix-apparent-out-of-bounds-access.patch
Patch34: 0034-libmultipath-fix-apparent-overflow.patch
Patch35: 0035-libmultipath-fix-int-overflow-in-sysfs_set_scsi_tmo.patch
Patch36: 0036-libmultipath-fix-enum-misuse-for-find_multipaths.patch
Patch37: 0037-libmultipath-fix-possible-NULL-dereference.patch
Patch38: 0038-fix-syntax-error.patch
Patch39: 0039-bugfix-change-log-level-to-info-if-alua-is-not-support-by-s.patch
Patch40: 0040-bugfix-clear-mpp-path-reference-when-path-is-freed-otherwis.patch
Patch41: 0041-bugfix-libmultipath-fix-memory-leaks-from-scandir-use.patch
Patch42: 0042-bugfix-libmultipath-fix-memory-leak-in-disassemble_map.patch
Patch43: 0043-multipathd-fix-mpp-hwe-handling-when-paths-are-freed.patch
Patch44: 0044-bugfix-check-close-return-value.patch
Patch45: 0045-fix-find-multipath-failure.patch
Patch46: 0046-change-kpartx-file-and-default-bindir.patch
Patch47: 0047-multipathd-ignore-failed-wwid-recheck.patch
Patch48: 0048-libmultipath-group_by_prio-fix-signedness-bug.patch
Patch49: 0049-multipathd-handle-NULL-return-from-genhelp_handler.patch
Patch50: 0050-libmultipath-fix-parsing-of-VPD-83-type-1-T10-vendor.patch
Patch51: 0051-libmultipath-Fix-buffer-overflow-in-parse_vpd_pg80.patch
Patch52: 0052-libmultipath-fix-another-WWID-overflow-in-parse_vpd_.patch
Patch53: 0053-libmultipath-fix-possible-WWID-overflow-in-parse_vpd.patch
Patch54: 0054-libmultipath-fix-parsing-of-SCSI-name-string-iqn-for.patch
Patch55: 0055-libmultipath-fix-double-free-in-pgpolicyfn-error-pat.patch
Patch56: 0056-libmultipath-fix-files-read-from-config_dir.patch
Patch57: 0057-libmultipath-fix-sgio_get_vpd-looping.patch
BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89 BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89
BuildRequires: libselinux-devel, libsepol-devel, readline-devel, ncurses-devel, git BuildRequires: libselinux-devel, libsepol-devel, readline-devel, ncurses-devel, git
@ -123,7 +85,7 @@ Summary: Create device maps from partition tables.
Reads partition tables and create device maps over partitions segments detected. Reads partition tables and create device maps over partitions segments detected.
%prep %prep
%autosetup -Sgit -n multipath-tools-ef6d98b %autosetup -Sgit -n multipath-tools-d491591
cp %{SOURCE1} . cp %{SOURCE1} .
%build %build
@ -207,6 +169,9 @@ fi
%changelog %changelog
* Thu Jul 16 2020 lixiaokeng <lixiaokeng@huawei.com> - 0.8.4-1
- update to 0.8.4-1
* Sun Jul 5 2020 Zhiqiang Liu <lzhq28@mail.ustc.edu.cn> - 0.7.7-20 * Sun Jul 5 2020 Zhiqiang Liu <lzhq28@mail.ustc.edu.cn> - 0.7.7-20
- remove useless readme files. - remove useless readme files.