!43 update to 0.8.5

From: @lixiaokeng
Reviewed-by: 
Signed-off-by:
This commit is contained in:
openeuler-ci-bot 2021-02-03 14:49:31 +08:00 committed by Gitee
commit d39e9994fc
28 changed files with 232 additions and 646 deletions

View File

@ -1,4 +1,4 @@
From 4340aca696857c1077b00ff6bdc0454a07929aad Mon Sep 17 00:00:00 2001 From afc8dd3d344cd23f7ea861fa52b2d83bf0c3f036 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com> From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 15 May 2015 18:14:09 -0500 Date: Fri, 15 May 2015 18:14:09 -0500
Subject: [PATCH] change order of multipath.rules Subject: [PATCH] change order of multipath.rules

View File

@ -1,4 +1,4 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From eb3e69bd510b20772734724d02f84c2e3946d560 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com> From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 16 Oct 2014 15:49:01 -0500 Date: Thu, 16 Oct 2014 15:49:01 -0500
Subject: [PATCH] RH: add mpathconf Subject: [PATCH] RH: add mpathconf
@ -654,6 +654,5 @@ index 0000000..5b7ae0c
+.SH AUTHOR +.SH AUTHOR
+Benjamin Marzinski <bmarzins@redhat.com> +Benjamin Marzinski <bmarzins@redhat.com>
-- --
2.7.4 1.8.3.1

View File

@ -1,30 +0,0 @@
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,4 +1,4 @@
From e6ed042c280b0e40185490a9a69cccbcdf75bbf4 Mon Sep 17 00:00:00 2001 From 1d147380cd35cf2576420347514b67972f972ac3 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
@ -13,38 +13,26 @@ it.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com> Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
--- ---
libmultipath/blacklist.c | 12 ++++-------- libmultipath/blacklist.c | 6 ++----
multipath/multipath.conf.5 | 12 ++++++------ multipath/multipath.conf.5 | 11 ++++++-----
2 files changed, 10 insertions(+), 14 deletions(-) tests/blacklist.c | 7 ++-----
3 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 00e8dbd..a8e0311 100644 index 6c6a597..785f5ee 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) @@ -201,9 +201,6 @@ setup_default_blist (struct config * conf)
if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT)) if (store_ble(conf->blist_devnode, "!^(sd[a-z]|dasd[a-z]|nvme[0-9])", ORIGIN_DEFAULT))
return 1; return 1;
- str = STRDUP("(SCSI_IDENT_|ID_WWN)"); - if (store_ble(conf->elist_property, "(SCSI_IDENT_|ID_WWN)", ORIGIN_DEFAULT))
- if (!str)
- return 1;
- if (store_ble(conf->elist_property, str, ORIGIN_DEFAULT))
- return 1; - return 1;
- -
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,
@@ -395,7 +389,8 @@ filter_property(struct config *conf, struct udev_device *udev, int lvl, @@ -407,7 +404,8 @@ filter_property(const struct config *conf, struct udev_device *udev,
if (udev) {
/*
* This is the inverse of the 'normal' matching;
- * the environment variable _has_ to match.
+ * the environment variable _has_ to match
+ * 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'; *uid_attribute != '\0';
bool uid_attr_seen = false; bool uid_attr_seen = false;
@ -55,10 +43,10 @@ index 00e8dbd..a8e0311 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 05a5e8f..2f2d8cc 100644 index d2101ed..098523c 100644
--- a/multipath/multipath.conf.5 --- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5
@@ -1286,7 +1286,8 @@ keywords. Both are regular expressions. For a full description of these keywords @@ -1313,9 +1313,14 @@ 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,
@ -67,8 +55,14 @@ index 05a5e8f..2f2d8cc 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.
+For example, setting the property blacklist_exception to
+\fB(SCSI_IDENT_|ID_WWN)\fR, will cause well-behaved SCSI devices and devices
+that provide a WWN (World Wide Number) to be included, and all others to be
+excluded. This works to exclude most non-multipathable devices.
. .
@@ -1299,11 +1300,10 @@ Blacklisting by missing properties is only applied to devices which do have the .RS
.PP
@@ -1326,10 +1331,6 @@ Blacklisting by missing properties is only applied to devices which do have the
property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR) property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR)
set. Previously, it was applied to every device, possibly causing devices to be set. Previously, it was applied to every device, possibly causing devices to be
blacklisted because of temporary I/O error conditions. blacklisted because of temporary I/O error conditions.
@ -76,14 +70,35 @@ index 05a5e8f..2f2d8cc 100644
-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)
-to be included, and all others to be excluded. -to be included, and all others to be excluded.
-.RE .RE
+For example, setting the property blacklist_exception to
+\fB(SCSI_IDENT_|ID_WWN)\fR, will cause well-behaved SCSI devices and devices
+that provide a WWN (World Wide Number) to be included, and all others to be
+excluded. This works to exclude most non-multipathable devices.
.TP .TP
.B protocol .B protocol
Regular expression for the protocol of a device to be excluded/included. diff --git a/tests/blacklist.c b/tests/blacklist.c
index 84a3ba2..adfbf28 100644
--- a/tests/blacklist.c
+++ b/tests/blacklist.c
@@ -373,9 +373,8 @@ static void test_property_missing(void **state)
{
static struct udev_device udev = { "sdb", { "ID_FOO", "ID_BAZ", "ID_BAR", "ID_SERIAL", NULL } };
conf.blist_property = blist_property_wwn;
- expect_condlog(3, "sdb: blacklisted, udev property missing\n");
assert_int_equal(filter_property(&conf, &udev, 3, "ID_SERIAL"),
- MATCH_PROPERTY_BLIST_MISSING);
+ MATCH_NOTHING);
assert_int_equal(filter_property(&conf, &udev, 3, "ID_BLAH"),
MATCH_NOTHING);
assert_int_equal(filter_property(&conf, &udev, 3, ""),
@@ -467,9 +466,7 @@ static void test_filter_path_missing1(void **state)
conf.blist_device = blist_device_foo_bar;
conf.blist_protocol = blist_protocol_fcp;
conf.blist_wwid = blist_wwid_xyzzy;
- expect_condlog(3, "sdb: blacklisted, udev property missing\n");
- assert_int_equal(filter_path(&conf, &miss1_pp),
- MATCH_PROPERTY_BLIST_MISSING);
+ assert_int_equal(filter_path(&conf, &miss1_pp), MATCH_NOTHING);
}
/* This one matches the property whitelist, to test the other missing
-- --
1.8.3.1 1.8.3.1

View File

@ -1,42 +0,0 @@
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,4 +1,4 @@
From 8e4c5a421ee351fe667b0bf8b99e691ab5c9c13b Mon Sep 17 00:00:00 2001 From c220115428e3de8f189afccadf6dc823825429fa Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com> From: wangjufeng <wangjufeng@huawei.com>
Date: Fri, 1 Nov 2019 16:48:49 +0800 Date: Fri, 1 Nov 2019 16:48:49 +0800
Subject: [PATCH] fix syntax error Subject: [PATCH] fix syntax error
@ -8,7 +8,7 @@ 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 d4d1e0d..158e7b6 100644 index e05f3a9..f4d895d 100644
--- a/Makefile.inc --- a/Makefile.inc
+++ b/Makefile.inc +++ b/Makefile.inc
@@ -41,7 +41,7 @@ ifndef SYSTEMD @@ -41,7 +41,7 @@ ifndef SYSTEMD

View File

@ -1,6 +1,6 @@
--- a/multipathd/cli_handlers.c --- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c
@@ -593,9 +593,10 @@ @@ -981,9 +981,10 @@ cli_resize(void *v, char **reply, int *len, void *data)
char * mapname = get_keyparam(v, MAP); char * mapname = get_keyparam(v, MAP);
struct multipath *mpp; struct multipath *mpp;
int minor; int minor;
@ -12,7 +12,7 @@
mapname = convert_dev(mapname, 0); mapname = convert_dev(mapname, 0);
condlog(2, "%s: resize map (operator)", mapname); condlog(2, "%s: resize map (operator)", mapname);
@@ -627,6 +628,22 @@ @@ -1021,6 +1022,22 @@ cli_resize(void *v, char **reply, int *len, void *data)
mapname); mapname);
return 1; return 1;
} }
@ -35,3 +35,6 @@
if (size == mpp->size) { if (size == mpp->size) {
condlog(0, "%s: map is still the same size (%llu)", mapname, condlog(0, "%s: map is still the same size (%llu)", mapname,
mpp->size); mpp->size);
--
1.8.3.1

View File

@ -1,7 +1,7 @@
From 6c79d35c3d351323d18b63d76450fcfbb6ef5b56 Mon Sep 17 00:00:00 2001 From 2870e594978f683a97f32a8f9d8ed1747caae60e Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com> From: sunguoshuai <sunguoshuai@huawei.com>
Date: Tue, 22 Jan 2019 22:00:35 -0500 Date: Tue, 22 Jan 2019 22:00:35 -0500
Subject: [PATCH] Module: fix lun expansion failure when there is offline path Subject: [PATCH] avoid handling paths repeatedly in coalesce paths
reason:fix lun expansion failure when there is offline path reason:fix lun expansion failure when there is offline path
--- ---
@ -12,10 +12,10 @@ reason:fix lun expansion failure when there is offline path
4 files changed, 14 insertions(+) 4 files changed, 14 insertions(+)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 09c3dcf..1b1cc55 100644 index 6fb477f..ff65c1b 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, @@ -1166,6 +1166,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; int invalid;
@ -23,7 +23,7 @@ index 09c3dcf..1b1cc55 100644
/* skip this path for some reason */ /* skip this path for some reason */
/* 1. if path has no unique id or wwid blacklisted */ /* 1. if path has no unique id or wwid blacklisted */
@@ -1053,6 +1054,12 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, @@ -1202,6 +1203,12 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
orphan_path(pp1, "only one path"); orphan_path(pp1, "only one path");
continue; continue;
} }
@ -36,7 +36,7 @@ index 09c3dcf..1b1cc55 100644
/* /*
* at this point, we know we really got a new mp * at this point, we know we really got a new mp
@@ -1071,6 +1078,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, @@ -1220,6 +1227,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
for (i = k + 1; i < VECTOR_SIZE(pathvec); i++) { for (i = k + 1; i < VECTOR_SIZE(pathvec); i++) {
pp2 = VECTOR_SLOT(pathvec, i); pp2 = VECTOR_SLOT(pathvec, i);
@ -48,10 +48,10 @@ index 09c3dcf..1b1cc55 100644
if (strcmp(pp1->wwid, pp2->wwid)) if (strcmp(pp1->wwid, pp2->wwid))
continue; continue;
diff --git a/libmultipath/structs.c b/libmultipath/structs.c diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index ae847d6..99435c1 100644 index 464596f..e5de0a7 100644
--- a/libmultipath/structs.c --- a/libmultipath/structs.c
+++ b/libmultipath/structs.c +++ b/libmultipath/structs.c
@@ -100,6 +100,7 @@ alloc_path (void) @@ -101,6 +101,7 @@ alloc_path (void)
pp->fd = -1; pp->fd = -1;
pp->tpgs = TPGS_UNDEF; pp->tpgs = TPGS_UNDEF;
pp->priority = PRIO_UNDEF; pp->priority = PRIO_UNDEF;
@ -60,10 +60,10 @@ index ae847d6..99435c1 100644
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;
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 7de93d6..022ba12 100644
--- a/libmultipath/structs.h --- a/libmultipath/structs.h
+++ b/libmultipath/structs.h +++ b/libmultipath/structs.h
@@ -277,6 +277,7 @@ struct path { @@ -280,6 +280,7 @@ struct path {
struct checker checker; struct checker checker;
struct multipath * mpp; struct multipath * mpp;
int fd; int fd;
@ -72,10 +72,10 @@ index 0a2623a..d667cb7 100644
int retriggers; int retriggers;
unsigned int path_failures; 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 8895fa7..8676081 100644
--- a/libmultipath/structs_vec.c --- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c
@@ -388,6 +388,7 @@ int verify_paths(struct multipath *mpp, struct vectors *vecs) @@ -738,6 +738,7 @@ int verify_paths(struct multipath *mpp)
return 0; return 0;
vector_foreach_slot (mpp->paths, pp, i) { vector_foreach_slot (mpp->paths, pp, i) {

View File

@ -1,8 +1,18 @@
From 5ebbef9c1f3ae72efe7f9582532a346227a0a1a3 Mon Sep 17 00:00:00 2001
From: renmingshuai <renmingshuai@huawei.com>
Date: Thu, 28 Jan 2021 22:26:58 +0800
Subject: [PATCH] fix lun expansion failure when there is offline path
---
libmultipath/configure.c | 20 +++++++++++++++-----
libmultipath/structs_vec.c | 5 +++--
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 1b1cc55..f66bd5b 100644 index ff65c1b..e616da2 100644
--- a/libmultipath/configure.c --- a/libmultipath/configure.c
+++ b/libmultipath/configure.c +++ b/libmultipath/configure.c
@@ -1054,11 +1054,18 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, @@ -1203,11 +1203,18 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
orphan_path(pp1, "only one path"); orphan_path(pp1, "only one path");
continue; continue;
} }
@ -26,7 +36,7 @@ index 1b1cc55..f66bd5b 100644
/* /*
@@ -1086,6 +1093,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, @@ -1235,6 +1242,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
if (strcmp(pp1->wwid, pp2->wwid)) if (strcmp(pp1->wwid, pp2->wwid))
continue; continue;
@ -37,18 +47,21 @@ index 1b1cc55..f66bd5b 100644
mpp->size = pp2->size; mpp->size = pp2->size;
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 d85eb5f..6c42824 100644 index 8676081..0300add 100644
--- a/libmultipath/structs_vec.c --- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c
@@ -394,8 +394,9 @@ int verify_paths(struct multipath *mpp, struct vectors *vecs) @@ -742,8 +742,9 @@ int verify_paths(struct multipath *mpp)
/* /*
* see if path is in sysfs * see if path is in sysfs
*/ */
- if (sysfs_attr_get_value(pp->udev, "dev", - if (!pp->udev || sysfs_attr_get_value(pp->udev, "dev",
- pp->dev_t, BLK_DEV_SIZE) < 0) { - pp->dev_t, BLK_DEV_SIZE) < 0) {
+ if ((sysfs_attr_get_value(pp->udev, "dev", + if (!pp->udev || (sysfs_attr_get_value(pp->udev, "dev",
+ pp->dev_t, BLK_DEV_SIZE) < 0) || + pp->dev_t, BLK_DEV_SIZE) < 0) ||
+ (pp->state == PATH_DOWN && pp->size != mpp->size)) { + (pp->state == PATH_DOWN && pp->size != mpp->size)) {
if (pp->state != PATH_DOWN) { if (pp->state != PATH_DOWN) {
condlog(1, "%s: removing valid path %s in state %d", condlog(1, "%s: removing valid path %s in state %d",
mpp->alias, pp->dev, pp->state); mpp->alias, pp->dev, pp->state);
--
1.8.3.1

View File

@ -1,4 +1,4 @@
From 96ebdd776e676d24ddb5c6c877e2e13ece1717b3 Mon Sep 17 00:00:00 2001 From a4485f642dc3f07f9f61245f4a5de559d3193649 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
@ -118,10 +118,10 @@ index 88cac5f..075751c 100644
int getprio (struct path * pp, __attribute__((unused)) char *args, 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 38cf1e9..790143d 100644 index 8895fa7..34ee661 100644
--- a/libmultipath/structs_vec.c --- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c +++ b/libmultipath/structs_vec.c
@@ -34,8 +34,10 @@ int update_mpp_paths(struct multipath *mpp, vector pathvec) @@ -35,8 +35,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 38cf1e9..790143d 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 23fb9d4..ef14750 100644 index a4abbb2..12459ab 100644
--- a/multipathd/main.c --- a/multipathd/main.c
+++ b/multipathd/main.c +++ b/multipathd/main.c
@@ -1665,6 +1665,11 @@ enable_group(struct path * pp) @@ -1725,6 +1725,11 @@ enable_group(struct path * pp)
pgp = VECTOR_SLOT(pp->mpp->pg, pp->pgindex - 1); pgp = VECTOR_SLOT(pp->mpp->pg, pp->pgindex - 1);

View File

@ -1,55 +0,0 @@
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

@ -1,8 +1,7 @@
From aa3dbb9a4c7ba220139801533a27d99542d4e909 Mon Sep 17 00:00:00 2001 From 30ea73e8896765854fdf845fbb12b6eb85531527 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com> From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 02:21:31 -0500 Date: Wed, 23 Jan 2019 02:21:31 -0500
Subject: [PATCH] fix change reservation key to uint8 for Subject: [PATCH] fix change reservation key to uint8 for memcmp
memcmp
reason:fix change reservation key to uint8 for memcmp reason:fix change reservation key to uint8 for memcmp
--- ---
@ -10,10 +9,10 @@ reason:fix change reservation key to uint8 for memcmp
1 file changed, 12 insertions(+), 2 deletions(-) 1 file changed, 12 insertions(+), 2 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 691b4e1..a2907db 100644 index 1f9817e..557d582 100644
--- a/libmpathpersist/mpath_persist.c --- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c
@@ -263,6 +263,9 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, @@ -249,6 +249,9 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
int ret; int ret;
uint64_t prkey; uint64_t prkey;
struct config *conf; struct config *conf;
@ -23,7 +22,7 @@ index 691b4e1..a2907db 100644
ret = mpath_get_map(fd, &alias, &mpp); ret = mpath_get_map(fd, &alias, &mpp);
if (ret != MPATH_PR_SUCCESS) if (ret != MPATH_PR_SUCCESS)
@@ -353,8 +356,15 @@ int mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, @@ -274,8 +277,15 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
} }
} }

View File

@ -1,4 +1,4 @@
From ed732bcdc90162993e82df1bec8642aabb7a64a5 Mon Sep 17 00:00:00 2001 From 70ff8a11623a0a0e7677c597b5fb1846149d7de3 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 f9c3be9..027d006 100644 index 557d582..5a8c69d 100644
--- a/libmpathpersist/mpath_persist.c --- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c +++ b/libmpathpersist/mpath_persist.c
@@ -309,7 +309,8 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, @@ -266,7 +266,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 f9c3be9..027d006 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)) {
@@ -326,12 +327,16 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope, @@ -283,12 +284,16 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
uireservation >>= 8; uireservation >>= 8;
} }

View File

@ -1,8 +1,6 @@
diff --git a/libmultipath/util.c b/libmultipath/util.c
index 8d8fcc8..3c284b7 100644
--- a/libmultipath/util.c --- a/libmultipath/util.c
+++ b/libmultipath/util.c +++ b/libmultipath/util.c
@@ -463,5 +463,12 @@ int safe_write(int fd, const void *buf, size_t count) @@ -368,6 +368,13 @@ int safe_write(int fd, const void *buf, size_t count)
count -= r; count -= r;
buf = (const char *)buf + r; buf = (const char *)buf + r;
} }
@ -15,3 +13,7 @@ index 8d8fcc8..3c284b7 100644
+ +
return 0; return 0;
} }
--
1.8.3.1

View File

@ -1,18 +1,18 @@
From 0008a2343765ab689cfc66acd8fc84630611d796 Mon Sep 17 00:00:00 2001 From a0cb1bf53c2a2b4089b98d3c811845517c95c6f5 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain> From: root <root@localhost.localdomain>
Date: Fri, 22 Mar 2019 19:37:43 +0800 Date: Fri, 22 Mar 2019 19:37:43 +0800
Subject: [PATCH 1/5] change log level to info if alua is not support by Subject: [PATCH] change log level to info if alua is not support by storage
storage server server
--- ---
libmultipath/prioritizers/alua.c | 2 +- libmultipath/prioritizers/alua.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-) 1 file changed, 1 insertion(+), 1 deletion(-)
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 1400b11..6b69982 100644 index e65b6f5..97eb152 100644
--- a/libmultipath/prioritizers/alua.c --- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c +++ b/libmultipath/prioritizers/alua.c
@@ -127,7 +127,7 @@ int getprio (struct path * pp, char * args, unsigned int timeout) @@ -130,7 +130,7 @@ int getprio (struct path * pp, char * args, unsigned int timeout)
} else { } else {
switch(-rc) { switch(-rc) {
case ALUA_PRIO_NOT_SUPPORTED: case ALUA_PRIO_NOT_SUPPORTED:
@ -22,5 +22,5 @@ index 1400b11..6b69982 100644
break; break;
case ALUA_PRIO_RTPG_FAILED: case ALUA_PRIO_RTPG_FAILED:
-- --
2.19.1 1.8.3.1

View File

@ -1,4 +1,4 @@
From 768883da9969b76aade3e16d4a5b8cec47d6f30e Mon Sep 17 00:00:00 2001 From 57e2c5ddceb461c00bc42c8cb2fd45665838e6d1 Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com> From: wangjufeng <wangjufeng@huawei.com>
Date: Fri, 10 Jan 2020 11:57:08 +0800 Date: Fri, 10 Jan 2020 11:57:08 +0800
Subject: [PATCH] kpartx: change kpartx file and default bindir Subject: [PATCH] kpartx: change kpartx file and default bindir
@ -13,10 +13,10 @@ Signed-off-by: wangjufeng <wangjufeng@huawei.com>
2 files changed, 2 insertions(+), 2 deletions(-) 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc diff --git a/Makefile.inc b/Makefile.inc
index af2f5ba..e6466ee 100644 index f4d895d..0b083eb 100644
--- a/Makefile.inc --- a/Makefile.inc
+++ b/Makefile.inc +++ b/Makefile.inc
@@ -49,7 +49,7 @@ ifndef SYSTEMDPATH @@ -51,7 +51,7 @@ ifndef SYSTEMDPATH
endif endif
prefix = prefix =
@ -26,10 +26,10 @@ index af2f5ba..e6466ee 100644
bindir = $(exec_prefix)/sbin bindir = $(exec_prefix)/sbin
libudevdir = $(prefix)/$(SYSTEMDPATH)/udev libudevdir = $(prefix)/$(SYSTEMDPATH)/udev
diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules diff --git a/kpartx/kpartx.rules b/kpartx/kpartx.rules
index 8f99049..8a3a171 100644 index d7527d7..0e0d70d 100644
--- a/kpartx/kpartx.rules --- a/kpartx/kpartx.rules
+++ b/kpartx/kpartx.rules +++ b/kpartx/kpartx.rules
@@ -32,6 +32,6 @@ LABEL="mpath_kpartx_end" @@ -36,6 +36,6 @@ LABEL="mpath_kpartx_end"
GOTO="kpartx_end" GOTO="kpartx_end"
LABEL="run_kpartx" LABEL="run_kpartx"

View File

@ -1,23 +1,23 @@
From a1461cbfa7ea2bccef20eb2f5275648452ee050c Mon Sep 17 00:00:00 2001 From a448fe41073d613764b8988d1e22ee0c6e7e3f92 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] remove local path
[Changelog]:add upgrade path [Changelog]:add upgrade path
[Author]:chenminhua [Author]:chenminhua
--- ---
libmultipath/discovery.c | 124 +++++++++++++++++++++++++++++++++++++++++++++-- libmultipath/discovery.c | 128 ++++++++++++++++++++++++++++++++++++++++++++---
libmultipath/discovery.h | 1 + libmultipath/discovery.h | 1 +
multipathd/main.c | 4 ++ multipathd/main.c | 4 ++
3 files changed, 124 insertions(+), 5 deletions(-) 3 files changed, 127 insertions(+), 6 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index ee3290c..c49848e 100644 index c2e1754..24e9b50 100644
--- a/libmultipath/discovery.c --- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c +++ b/libmultipath/discovery.c
@@ -34,6 +34,103 @@ @@ -36,6 +36,103 @@
#include "prioritizers/alua_rtpg.h" #include "configure.h"
#include "foreign.h" #include "print.h"
+const char *conf_file = "/etc/multipath_private.conf"; +const char *conf_file = "/etc/multipath_private.conf";
+static int conf_file_parsed = 0; +static int conf_file_parsed = 0;
@ -119,55 +119,61 @@ index ee3290c..c49848e 100644
struct vpd_vendor_page vpd_vendor_pages[VPD_VP_ARRAY_SIZE] = { struct vpd_vendor_page vpd_vendor_pages[VPD_VP_ARRAY_SIZE] = {
[VPD_VP_UNDEF] = { 0x00, "undef" }, [VPD_VP_UNDEF] = { 0x00, "undef" },
[VPD_VP_HP3PAR] = { 0xc0, "hp3par" }, [VPD_VP_HP3PAR] = { 0xc0, "hp3par" },
@@ -124,6 +221,7 @@ path_discover (vector pathvec, struct config * conf, @@ -127,22 +224,35 @@ path_discover (vector pathvec, struct config * conf,
{ {
struct path * pp; struct path *pp;
const char * devname; char devt[BLK_DEV_SIZE];
+ int err = 1; + int err = 1;
dev_t devnum = udev_device_get_devnum(udevice);
devname = udev_device_get_sysname(udevice); snprintf(devt, BLK_DEV_SIZE, "%d:%d",
if (!devname) major(devnum), minor(devnum));
@@ -137,12 +235,22 @@ path_discover (vector pathvec, struct config * conf, pp = find_path_by_devt(pathvec, devt);
snprintf(devt, BLK_DEV_SIZE, "%d:%d", - if (!pp)
major(devnum), minor(devnum)); - return store_pathinfo(pathvec, conf,
pp = find_path_by_devt(pathvec, devt); - udevice, flag | DI_BLACKLIST,
- if (!pp) - NULL);
- return store_pathinfo(pathvec, conf, - else
- udevice, flag | DI_BLACKLIST, + if (!pp) {
- NULL); + err = store_pathinfo(pathvec, conf,
+ if (!pp) { + udevice, flag | DI_BLACKLIST,
+ err = store_pathinfo(pathvec, conf, + &pp);
+ udevice, flag, &pp); + if (err == 1)
+ if (err == 1) + return 1;
+ return 1; + if (err == 0)
+ if (err == 0) + remove_local_path(pathvec, pp);
+ remove_local_path(pathvec, pp); + return 0;
+ return 0; + }
+ } + else {
} /*
- return pathinfo(pp, conf, flag); * Don't use DI_BLACKLIST on paths already in pathvec. We rely
+ err = pathinfo(pp, conf, flag); * on the caller to pre-populate the pathvec with valid paths
+ if (err) * only.
+ return err; */
- return pathinfo(pp, conf, flag);
+ err = pathinfo(pp, conf, flag);
+ if (err)
+ return err;
+ +
+ remove_local_path(pathvec, pp); + remove_local_path(pathvec, pp);
+ return err; + return err;
+ }
} }
static void cleanup_udev_enumerate_ptr(void *arg) static void cleanup_udev_enumerate_ptr(void *arg)
@@ -2091,6 +2199,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask) @@ -2138,6 +2248,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
if (rc != PATHINFO_OK) if (rc != PATHINFO_OK)
return rc; return rc;
+
+ /* 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 (pp->bus == SYSFS_BUS_SCSI &&
if (mask & DI_BLACKLIST && mask & DI_SYSFS) { pp->sg_id.proto_id == SCSI_PROTOCOL_USB &&
!conf->allow_usb_devices) {
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 6444887..a438b44 100644 index 6444887..a438b44 100644
--- a/libmultipath/discovery.h --- a/libmultipath/discovery.h
@ -181,10 +187,10 @@ index 6444887..a438b44 100644
/* /*
* 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 ef14750..41c4258 100644 index 12459ab..0b572ee 100644
--- a/multipathd/main.c --- a/multipathd/main.c
+++ b/multipathd/main.c +++ b/multipathd/main.c
@@ -943,6 +943,10 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) @@ -964,6 +964,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;

View File

@ -1,4 +1,4 @@
From 4ac8e63deadf125004eacbc76859cfa7a46e1e16 Mon Sep 17 00:00:00 2001 From dd0c8768be8605040100cf8260f6b1405c264ffe 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
@ -13,14 +13,14 @@ call stack:
--- ---
libmultipath/discovery.c | 10 ++++++---- libmultipath/discovery.c | 10 ++++++----
libmultipath/discovery.h | 2 +- libmultipath/discovery.h | 2 +-
multipathd/main.c | 23 ++++++++++++++++++++++- multipathd/main.c | 24 +++++++++++++++++++++++-
3 files changed, 29 insertions(+), 6 deletions(-) 3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index c49848e..2458bf5 100644 index 24e9b50..b5cbc88 100644
--- a/libmultipath/discovery.c --- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c +++ b/libmultipath/discovery.c
@@ -112,7 +112,7 @@ transport (int h) @@ -114,7 +114,7 @@ transport (int h)
} }
int int
@ -29,7 +29,7 @@ index c49848e..2458bf5 100644
{ {
int i = -1; int i = -1;
@@ -127,7 +127,9 @@ remove_local_path (vector pathvec, struct path *pp) @@ -129,7 +129,9 @@ remove_local_path (vector pathvec, struct path *pp)
if ((i = find_slot(pathvec, (void *)pp)) != -1) { if ((i = find_slot(pathvec, (void *)pp)) != -1) {
vector_del_slot(pathvec, i); vector_del_slot(pathvec, i);
} }
@ -40,24 +40,24 @@ index c49848e..2458bf5 100644
return 0; return 0;
} }
@@ -241,7 +243,7 @@ path_discover (vector pathvec, struct config * conf, @@ -237,7 +239,7 @@ path_discover (vector pathvec, struct config * conf,
if (err == 1) if (err == 1)
return 1; return 1;
if (err == 0) if (err == 0)
- remove_local_path(pathvec, pp); - remove_local_path(pathvec, pp);
+ remove_local_path(pathvec, pp, 1); + remove_local_path(pathvec, pp, 1);
return 0; return 0;
}
} }
@@ -249,7 +251,7 @@ path_discover (vector pathvec, struct config * conf, else {
if (err) @@ -250,7 +252,7 @@ path_discover (vector pathvec, struct config * conf,
if (err)
return err;
- remove_local_path(pathvec, pp);
+ remove_local_path(pathvec, pp, 1);
return err; return err;
}
- remove_local_path(pathvec, pp);
+ remove_local_path(pathvec, pp, 1);
return err;
} }
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index a438b44..ab73493 100644 index a438b44..ab73493 100644
--- a/libmultipath/discovery.h --- a/libmultipath/discovery.h
@ -72,10 +72,10 @@ index a438b44..ab73493 100644
/* /*
* 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 41c4258..09ea102 100644 index 0b572ee..a10eba0 100644
--- a/multipathd/main.c --- a/multipathd/main.c
+++ b/multipathd/main.c +++ b/multipathd/main.c
@@ -841,6 +841,21 @@ ev_remove_map (char * devname, char * alias, int minor, struct vectors * vecs) @@ -813,6 +813,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 41c4258..09ea102 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)
{ {
@@ -883,6 +898,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map) @@ -904,6 +919,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 41c4258..09ea102 100644
free_path(pp); free_path(pp);
} else { } else {
condlog(0, "%s: failed to reinitialize path", condlog(0, "%s: failed to reinitialize path",
@@ -944,8 +960,11 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) @@ -965,8 +981,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,7 +118,7 @@ index 41c4258..09ea102 100644
/* /*
* need path UID to go any further * need path UID to go any further
@@ -960,6 +979,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map) @@ -981,6 +1000,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);
@ -126,14 +126,15 @@ index 41c4258..09ea102 100644
free_path(pp); free_path(pp);
return 1; return 1;
} }
@@ -1205,6 +1225,7 @@ out: @@ -1242,6 +1262,8 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
if ((i = find_slot(vecs->pathvec, (void *)pp)) != -1) /* mpp == NULL */
vector_del_slot(vecs->pathvec, i); if ((i = find_slot(vecs->pathvec, (void *)pp)) != -1)
vector_del_slot(vecs->pathvec, i);
+ clear_ref_from_mpp(pp, vecs); +
free_path(pp); + clear_ref_from_mpp(pp, vecs);
free_path(pp);
return retval; }
out:
-- --
1.8.3.1 1.8.3.1

View File

@ -1,87 +0,0 @@
From db72d840682d15abb2e6694704a91200e513dbac Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 22 Mar 2019 20:33:53 +0800
Subject: [PATCH 5/5] libmultipath: fix memory leak in disassemble_map
---
libmultipath/dmparser.c | 12 ++++++++++--
libmultipath/structs_vec.c | 10 ++++++++++
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/libmultipath/dmparser.c b/libmultipath/dmparser.c
index 620f507..1558c4e 100644
--- a/libmultipath/dmparser.c
+++ b/libmultipath/dmparser.c
@@ -142,6 +142,7 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
int def_minio = 0;
struct path * pp;
struct pathgroup * pgp;
+ int pp_unfound;
p = params;
@@ -291,6 +292,7 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
char devname[FILE_NAME_SIZE];
pp = NULL;
+ pp_unfound = 0;
p += get_word(p, &word);
if (!word)
@@ -310,6 +312,7 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
}
if (!pp) {
+ pp_unfound = 1;
pp = alloc_path();
if (!pp)
@@ -322,8 +325,10 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
WWID_SIZE);
}
/* Only call this in multipath client mode */
- if (!is_daemon && store_path(pathvec, pp))
+ if (!is_daemon && store_path(pathvec, pp)) {
+ free_path(pp);
goto out1;
+ }
} else {
if (!strlen(pp->wwid) &&
strlen(mpp->wwid))
@@ -332,8 +337,11 @@ int disassemble_map(vector pathvec, char *params, struct multipath *mpp,
}
FREE(word);
- if (store_path(pgp->paths, pp))
+ if (store_path(pgp->paths, pp)) {
+ if (pp_unfound)
+ free_path(pp);
goto out;
+ }
/*
* Update wwid for multipaths which are not setup
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 6c42824..828aef2 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -252,6 +252,16 @@ void sync_paths(struct multipath *mpp, vector pathvec)
update_mpp_paths(mpp, pathvec);
vector_foreach_slot (mpp->paths, pp, i)
pp->mpp = mpp;
+
+ vector_foreach_slot (mpp->pg, pgp, i) {
+ vector_foreach_slot (pgp->paths, pp, j) {
+ if ((find_slot(mpp->paths, pp) == -1) \
+ && (find_slot(pathvec, pp) == -1)) {
+ vector_del_slot(pgp->paths, j--);
+ free_path(pp);
+ }
+ }
+ }
}
int
--
2.19.1

View File

@ -1,84 +0,0 @@
From 7aa405ce7decd3609bcb76fa72a0ebe17ef3a635 Mon Sep 17 00:00:00 2001
From: lixiaokeng <lixiaokeng@huawei.com>
Date: Mon, 13 Jul 2020 13:07:40 +0200
Subject: [PATCH 1/4] master - libmultipath: fix use after free when iscsi logs
in
When two iscsi ips log in and out alternately and the following scripts run
at the same time,
#!/bin/bash
interval=5
while true
do
iscsiadm -m node -p 9.41.147.171 &> /dev/null
iscsiadm -m node -p 9.41.148.172 &> /dev/null
iscsiadm -m session &> /dev/null
rescan-scsi-bus.sh &> /dev/null
multipath -v2 &> /dev/null
multipath -ll &> /dev/null
sleep $interval
done
multipathd will have a segfault after about 30 mins.
The reason is that mpp->hwe is accessed after hwe is already freed. In
extract_hwe_from_path func, mpp->hwe is set to pp->hwe, so they points to the
same hwe. For some reasons, pp->mpp will be set to NULL in orphan_path func.
Then, pp and hwe will be freed with (pp->mpp == NULL) in free_path func
called by ev_remove_path func. However, mpp->hwe is not set to NULL while hwe
is already freed. So, when iscsi device logs in and new path is added to mpp,
mpp->hwe will be accessed in select_pgfailback func. Finally, use-after-free
problem occurs.
The procedure details given as follows,
1.wait_dmevents thread
wait_dmevents
->dmevent_loop
->update_multipath
->__setup_multipath
->update_multipath_strings
-> sync_paths
->orphan_path
2.uevqloop thread (iscsi log out, remove path)
uevqloop
->uevent_dispatch
->service_uevq
->uev_remove_path
->ev_remove_path //pp->mpp is NULL
->free_path(pp)
//pp->hew are freed but mpp->hwe is not set to NULL
3.ev_remove_path (iscsi log in, add path)
uevqloop
->uevent_dispatch
->service_uevq
->ev_add_path
->select_pgfailback //mpp->hwe is accessed
Here, we will set mpp->hwe to NULL before setting pp->map to NULL in orphan_path
func.
Signed-off-by: Tianxiong Lu <lutianxiong@huawei.com>
Signed-off-by: lixiaokeng <lixiaokeng@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs_vec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 8137ea2..430eaad 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -93,6 +93,8 @@ int adopt_paths(vector pathvec, struct multipath *mpp)
void orphan_path(struct path *pp, const char *reason)
{
condlog(3, "%s: orphan path, %s", pp->dev, reason);
+ if (pp->mpp && pp->mpp->hwe == pp->hwe)
+ pp->mpp->hwe = NULL;
pp->mpp = NULL;
pp->dmstate = PSTATE_UNDEF;
pp->uid_attribute = NULL;
--
1.8.3.1

View File

@ -1,32 +0,0 @@
From c44d769bbca83b7dfe643712cc783db852a41b87 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 13 Jul 2020 13:07:41 +0200
Subject: [PATCH 2/4] libmultipath: warn if freeing path that holds mpp->hwe
This just adds an error message to the previous patch.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs_vec.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 430eaad..cde4dbe 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -93,8 +93,11 @@ int adopt_paths(vector pathvec, struct multipath *mpp)
void orphan_path(struct path *pp, const char *reason)
{
condlog(3, "%s: orphan path, %s", pp->dev, reason);
- if (pp->mpp && pp->mpp->hwe == pp->hwe)
+ if (pp->mpp && pp->hwe && pp->mpp->hwe == pp->hwe) {
+ condlog(0, "BUG: orphaning path %s that holds hwe of %s",
+ pp->dev, pp->mpp->alias);
pp->mpp->hwe = NULL;
+ }
pp->mpp = NULL;
pp->dmstate = PSTATE_UNDEF;
pp->uid_attribute = NULL;
--
1.8.3.1

View File

@ -1,32 +0,0 @@
From 1b21582e297d449918ea29bec2b3a0b7ba8fa84c Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 13 Jul 2020 13:07:42 +0200
Subject: [PATCH 3/4] libmultipath: warn about NULL value of mpp->hwe
mpp->hwe is only accessed in propsel.c. It may become unset if
all paths of the mpp have been deleted. Access to mpp->hwe in this
case should be avoided.
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/propsel.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index d362beb..6822827 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -65,7 +65,9 @@ do { \
__do_set_from_vec(struct hwentry, var, (src)->hwe, dest)
#define do_set_from_hwe(var, src, dest, msg) \
- if (__do_set_from_hwe(var, src, dest)) { \
+ if (!src->hwe) { \
+ condlog(0, "BUG: do_set_from_hwe called with hwe == NULL"); \
+ } else if (__do_set_from_hwe(var, src, dest)) { \
origin = msg; \
goto out; \
}
--
1.8.3.1

View File

@ -1,44 +0,0 @@
From 44292f529f6c50e1abbab04acf7f0169094bdf24 Mon Sep 17 00:00:00 2001
From: Martin Wilck <mwilck@suse.com>
Date: Mon, 13 Jul 2020 13:07:43 +0200
Subject: [PATCH 4/4] libmultipath: fix mpp->hwe handling in sync_paths()
This is anologous to
1f96269 ("multipathd: fix mpp->hwe handling on path removal")
f6839eb ("multipathd: fix mpp->hwe handling when paths are freed")
When paths are removed from a map, we need to make sure that
mpp->hwe doesn't become stale.
Reported-by: Lixiaokeng <lixiaokeng@huawei.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libmultipath/structs_vec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index cde4dbe..ede1429 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -260,6 +260,8 @@ void sync_paths(struct multipath *mpp, vector pathvec)
}
if (!found) {
condlog(3, "%s dropped path %s", mpp->alias, pp->dev);
+ if (mpp->hwe == pp->hwe)
+ mpp->hwe = NULL;
vector_del_slot(mpp->paths, i--);
orphan_path(pp, "path removed externally");
}
@@ -267,6 +269,8 @@ void sync_paths(struct multipath *mpp, vector pathvec)
update_mpp_paths(mpp, pathvec);
vector_foreach_slot (mpp->paths, pp, i)
pp->mpp = mpp;
+ if (mpp->hwe == NULL)
+ extract_hwe_from_path(mpp);
vector_foreach_slot (mpp->pg, pgp, i) {
vector_foreach_slot (pgp->paths, pp, j) {
--
1.8.3.1

View File

@ -1,40 +0,0 @@
From 82129852d74785267f95ef598ac483ff9af38a55 Mon Sep 17 00:00:00 2001
From: "mail@eworm.de" <mail@eworm.de>
Date: Sat, 25 Apr 2020 21:11:13 +0200
Subject: [PATCH] fix boolean value with json-c 0.14
Upstream json-c removed the TRUE and FALSE defines in commit
0992aac61f8b087efd7094e9ac2b84fa9c040fcd.
[mwilck]: Use stdbool.h, and keep the log message unchanged.
Signed-off-by: Christian Hesse <mail@eworm.de>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
libdmmp/libdmmp_private.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libdmmp/libdmmp_private.h b/libdmmp/libdmmp_private.h
index ac85b63..b1a6dde 100644
--- a/libdmmp/libdmmp_private.h
+++ b/libdmmp/libdmmp_private.h
@@ -30,6 +30,7 @@
#include <stdint.h>
#include <string.h>
#include <assert.h>
+#include <stdbool.h>
#include <json.h>
#include "libdmmp/libdmmp.h"
@@ -82,7 +83,7 @@ static out_type func_name(struct dmmp_context *ctx, const char *var_name) { \
do { \
json_type j_type = json_type_null; \
json_object *j_obj_tmp = NULL; \
- if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != TRUE) { \
+ if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != true) { \
_error(ctx, "Invalid JSON output from multipathd IPC: " \
"key '%s' not found", key); \
rc = DMMP_ERR_IPC_ERROR; \
--
1.8.3.1

BIN
multipath-tools-0.8.5.tgz Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,38 +1,29 @@
Name: multipath-tools Name: multipath-tools
Version: 0.8.4 Version: 0.8.5
Release: 4 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/gitweb.cgi?p=multipath-tools/.git;a=snapshot;h=d4915917655b3d205aa0e339ca13080ed8182d0d;sf=tgz" -o multipath-tools-d491591.tgz # curl https://github.com/opensvc/multipath-tools/archive/0.8.5.tar.gz -o multipath-tools-0.8.5.tgz
Source0: multipath-tools-d491591.tgz Source0: multipath-tools-0.8.5.tgz
Source1: multipath.conf Source1: multipath.conf
Patch1: 0001-change-order-of-multipath.rules.patch Patch1: 0001-change-order-of-multipath.rules.patch
Patch2: 0002-libmpathpersist-depend-on-libmultipath.patch Patch2: 0002-RH-add-mpathconf.patch
Patch3: 0003-libmultipath-assign-variable-to-make-gcc-happy.patch Patch3: 0003-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch4: 0004-RH-add-mpathconf.patch Patch4: 0004-fix-syntax-error.patch
Patch5: 0005-RH-Remove-the-property-blacklist-exception-builtin.patch Patch5: 0005-fix-multipathd-resize-when-not-all-paths-size-are-equal.patch
Patch6: 0006-fix-syntax-error.patch Patch6: 0006-avoid-handling-paths-repeatedly-in-coalesce-paths.patch
Patch7: 0007-fix-multipathd-resize-when-not-all-paths-size-are-equal.patch Patch7: 0007-bugfix-lun-expansion-failure-when-there-is-offline-path.patch
Patch8: 0008-multipathd-disable-queueing-for-recreated-map-in-uev.patch Patch8: 0008-fix-bugs-backported-from-next-branch.patch
Patch9: 0009-avoid-handling-paths-repeatedly-in-coalesce-paths.patch Patch9: 0009-bugfix-change-reservation-key-to-uint8-for-memcmp.patch
Patch10: 0010-fix-bugs-backported-from-next-branch.patch Patch10: 0010-ignore-for-clear-mismatch-key.patch
Patch11: 0011-bugfix-fix-change-reservation-key-to-uint8-for-memcmp.patch Patch11: 0011-bugfix-flush-and-sync-before-reboot.patch
Patch12: 0012-bugfix-ignore-for-clear-mismatch-key.patch Patch12: 0012-change-log-level-to-info-if-alua-is-not-support-by-s.patch
Patch13: 0013-bugfix-flush-and-sync-before-reboot.patch Patch13: 0013-fix-find-multipath-failure.patch
Patch14: 0014-bugfix-RH-remove-local-disk-from-pathvec.patch Patch14: 0014-kpartx-change-kpartx-file-and-default-bindir.patch
Patch15: 0015-bugfix-lun-expansion-failure-when-there-is-offline-path.patch Patch15: 0015-bugfix-RH-remove-local-disk-from-pathvec.patch
Patch16: 0016-bugfix-change-log-level-to-info-if-alua-is-not-support-by-s.patch Patch16: 0016-bugfix-clear-mpp-path-reference-when-path-is-freed-otherwis.patch
Patch17: 0017-bugfix-clear-mpp-path-reference-when-path-is-freed-otherwis.patch
Patch18: 0018-bugfix-libmultipath-fix-memory-leak-in-disassemble_map.patch
Patch19: 0019-fix-find-multipath-failure.patch
Patch20: 0020-change-kpartx-file-and-default-bindir.patch
Patch21: 0021-master-libmultipath-fix-use-after-free-when-iscsi-lo.patch
Patch22: 0022-libmultipath-warn-if-freeing-path-that-holds-mpp-hwe.patch
Patch23: 0023-libmultipath-warn-about-NULL-value-of-mpp-hwe.patch
Patch24: 0024-libmultipath-fix-mpp-hwe-handling-in-sync_paths.patch
Patch25: 0025-fix-boolean-value-with-json-c-0.14.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
BuildRequires: systemd-units, systemd-devel, json-c-devel, perl-interpreter, pkgconfig BuildRequires: systemd-units, systemd-devel, json-c-devel, perl-interpreter, pkgconfig
@ -88,7 +79,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-d491591 %autosetup -Sgit -n multipath-tools-0.8.5
cp %{SOURCE1} . cp %{SOURCE1} .
%build %build
@ -127,7 +118,7 @@ fi
%files %files
%doc README README.alua multipath.conf %doc README.md README.alua multipath.conf
%license LICENSES/GPL-2.0 LICENSES/LGPL-2.0 LICENSES/GPL-3.0 %license LICENSES/GPL-2.0 LICENSES/LGPL-2.0 LICENSES/GPL-3.0
%{_unitdir}/* %{_unitdir}/*
/usr/sbin/multipath /usr/sbin/multipath
@ -147,7 +138,7 @@ fi
%files devel %files devel
%doc README %doc README.md
%{_includedir}/*.h %{_includedir}/*.h
%dir %{_includedir}/libdmmp %dir %{_includedir}/libdmmp
%{_includedir}/libdmmp/* %{_includedir}/libdmmp/*
@ -163,7 +154,7 @@ fi
%files -n kpartx %files -n kpartx
%license LICENSES/GPL-2.0 %license LICENSES/GPL-2.0
%doc README %doc README.md
/usr/sbin/kpartx /usr/sbin/kpartx
/usr/lib/udev/kpartx_id /usr/lib/udev/kpartx_id
%config /usr/lib/udev/rules.d/11-dm-parts.rules %config /usr/lib/udev/rules.d/11-dm-parts.rules
@ -172,6 +163,9 @@ fi
%changelog %changelog
* Sat Jan 30 2020 lixiaokeng<lixiaokeng@huawei.com> - 0.8.5-1
- update to 0.8.5
* Fri Oct 16 2020 lixiaokeng<lixiaokeng@huawei.com> - 0.8.4-4 * Fri Oct 16 2020 lixiaokeng<lixiaokeng@huawei.com> - 0.8.4-4
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA