upgrade to 0.8.7

This commit is contained in:
Lixiaokeng 2021-11-23 21:49:34 +08:00
parent b646a60213
commit b6f069a7e4
22 changed files with 238 additions and 295 deletions

View File

@ -1,7 +1,7 @@
From afc8dd3d344cd23f7ea861fa52b2d83bf0c3f036 Mon Sep 17 00:00:00 2001
From d025415810a5792c333e99bd2f77a902c235ea09 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 15 May 2015 18:14:09 -0500
Subject: [PATCH] change order of multipath.rules
Subject: [PATCH 01/15] change order of multipath.rules
At least for RedHat, the rule that calls scsi_id is
60-persistent-storage.rules, so the multipath rule needs to come

View File

@ -1,7 +1,7 @@
From eb3e69bd510b20772734724d02f84c2e3946d560 Mon Sep 17 00:00:00 2001
From 1d3c03c1b5136be68aad4f98763537eb56735f0c Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 16 Oct 2014 15:49:01 -0500
Subject: [PATCH] RH: add mpathconf
Subject: [PATCH 02/15] RH: add mpathconf
mpathconf is a program (largely based on lvmcomf) to help users
configure /etc/multipath.conf and enable or disable multipathing. It

View File

@ -1,7 +1,7 @@
From 1d147380cd35cf2576420347514b67972f972ac3 Mon Sep 17 00:00:00 2001
From 7132016384684d7afaa677050454afdc73b18bd9 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Wed, 2 Jul 2014 12:49:53 -0500
Subject: [PATCH] RH: Remove the property blacklist exception builtin
Subject: [PATCH 03/15] RH: Remove the property blacklist exception builtin
Multipath set the default property blacklist exceptions to
(ID_SCSI_VPD|ID_WWN). This has the effect of blacklisting some internal
@ -19,10 +19,10 @@ Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
3 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
index 6c6a597..785f5ee 100644
index 4e315c9..1e463ef 100644
--- a/libmultipath/blacklist.c
+++ b/libmultipath/blacklist.c
@@ -201,9 +201,6 @@ setup_default_blist (struct config * conf)
@@ -202,9 +202,6 @@ setup_default_blist (struct config * conf)
if (store_ble(conf->blist_devnode, "!^(sd[a-z]|dasd[a-z]|nvme[0-9])", ORIGIN_DEFAULT))
return 1;
@ -32,7 +32,7 @@ index 6c6a597..785f5ee 100644
vector_foreach_slot (conf->hwtable, hwe, i) {
if (hwe->bl_product) {
if (find_blacklist_device(conf->blist_device,
@@ -407,7 +404,8 @@ filter_property(const struct config *conf, struct udev_device *udev,
@@ -410,7 +407,8 @@ filter_property(const struct config *conf, struct udev_device *udev,
*uid_attribute != '\0';
bool uid_attr_seen = false;
@ -43,10 +43,10 @@ index 6c6a597..785f5ee 100644
udev_device_get_properties_list_entry(udev)) {
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
index d2101ed..098523c 100644
index d6b8c7f..689d09a 100644
--- a/multipath/multipath.conf.5
+++ b/multipath/multipath.conf.5
@@ -1313,9 +1313,14 @@ keywords. Both are regular expressions. For a full description of these keywords
@@ -1347,9 +1347,14 @@ keywords. Both are regular expressions. For a full description of these keywords
Regular expression for an udev property. All
devices that have matching udev properties will be excluded/included.
The handling of the \fIproperty\fR keyword is special,
@ -62,7 +62,7 @@ index d2101ed..098523c 100644
.
.RS
.PP
@@ -1326,10 +1331,6 @@ Blacklisting by missing properties is only applied to devices which do have the
@@ -1360,10 +1365,6 @@ Blacklisting by missing properties is only applied to devices which do have the
property specified by \fIuid_attribute\fR (e.g. \fIID_SERIAL\fR)
set. Previously, it was applied to every device, possibly causing devices to be
blacklisted because of temporary I/O error conditions.
@ -74,10 +74,10 @@ index d2101ed..098523c 100644
.TP
.B protocol
diff --git a/tests/blacklist.c b/tests/blacklist.c
index 84a3ba2..adfbf28 100644
index 882aa3a..6a22b66 100644
--- a/tests/blacklist.c
+++ b/tests/blacklist.c
@@ -373,9 +373,8 @@ static void test_property_missing(void **state)
@@ -375,9 +375,8 @@ static void test_property_missing(void **state)
{
static struct udev_device udev = { "sdb", { "ID_FOO", "ID_BAZ", "ID_BAR", "ID_SERIAL", NULL } };
conf.blist_property = blist_property_wwn;
@ -88,7 +88,7 @@ index 84a3ba2..adfbf28 100644
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)
@@ -469,9 +468,7 @@ static void test_filter_path_missing1(void **state)
conf.blist_device = blist_device_foo_bar;
conf.blist_protocol = blist_protocol_fcp;
conf.blist_wwid = blist_wwid_xyzzy;

View File

@ -1,17 +1,17 @@
From c220115428e3de8f189afccadf6dc823825429fa Mon Sep 17 00:00:00 2001
From 4e43314afe869f70f96d58dc978d81e104acb650 Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com>
Date: Fri, 1 Nov 2019 16:48:49 +0800
Subject: [PATCH] fix syntax error
Subject: [PATCH 04/15] fix syntax error
---
Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile.inc b/Makefile.inc
index e05f3a9..f4d895d 100644
index d0ec9b4..9944aa1 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -41,7 +41,7 @@ ifndef SYSTEMD
@@ -43,7 +43,7 @@ ifndef SYSTEMD
else
ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
SYSTEMD = $(shell systemctl --version 2> /dev/null | \

View File

@ -1,6 +1,17 @@
From f3c11af226bcbb36da7c2802774c6128dd88b5b4 Mon Sep 17 00:00:00 2001
From: Lixiaokeng <lixiaokeng@huawei.com>
Date: Tue, 23 Nov 2021 20:14:23 +0800
Subject: [PATCH 05/15] fix multipathd resize when not all paths size are equal
---
multipathd/cli_handlers.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 6d3a0ae..aeb2be5 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -981,9 +981,10 @@ cli_resize(void *v, char **reply, int *len, void *data)
@@ -866,9 +866,10 @@ cli_resize(void *v, char **reply, int *len, void *data)
char * mapname = get_keyparam(v, MAP);
struct multipath *mpp;
int minor;
@ -12,7 +23,7 @@
mapname = convert_dev(mapname, 0);
condlog(2, "%s: resize map (operator)", mapname);
@@ -1021,6 +1022,22 @@ cli_resize(void *v, char **reply, int *len, void *data)
@@ -906,6 +907,22 @@ cli_resize(void *v, char **reply, int *len, void *data)
mapname);
return 1;
}

View File

@ -1,7 +1,7 @@
From 2870e594978f683a97f32a8f9d8ed1747caae60e Mon Sep 17 00:00:00 2001
From 1b330f511a8b73b56b282c9aa613faccdb9a72f7 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Tue, 22 Jan 2019 22:00:35 -0500
Subject: [PATCH] avoid handling paths repeatedly in coalesce paths
Subject: [PATCH 06/15] avoid handling paths repeatedly in coalesce paths
reason:fix lun expansion failure when there is offline path
---
@ -12,35 +12,35 @@ reason:fix lun expansion failure when there is offline path
4 files changed, 14 insertions(+)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index 6fb477f..ff65c1b 100644
index 7edb355..fdf8005 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1166,6 +1166,7 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
@@ -1150,6 +1150,7 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
goto out;
}
vector_foreach_slot (pathvec, pp1, k) {
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 */
/* 1. if path has no unique id or wwid blacklisted */
@@ -1202,6 +1203,12 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
@@ -1186,6 +1187,12 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
orphan_path(pp1, "only one path");
continue;
}
+ /* if path is handled before */
+ if (pp1->handled) {
+ condlog(3, "%s: skip handled path.", pp1->dev_t);
+ continue;
+ }
+ /* if path is handled before */
+ if (pp1->handled) {
+ condlog(3, "%s: skip handled path.", pp1->dev_t);
+ continue;
+ }
+
/*
* at this point, we know we really got a new mp
@@ -1220,6 +1227,10 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
@@ -1204,6 +1211,10 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
for (i = k + 1; i < VECTOR_SIZE(pathvec); i++) {
pp2 = VECTOR_SLOT(pathvec, i);
+ if (pp2->handled)
+ if (pp2->handled)
+ continue;
+
+
@ -48,7 +48,7 @@ index 6fb477f..ff65c1b 100644
if (strcmp(pp1->wwid, pp2->wwid))
continue;
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
index 464596f..e5de0a7 100644
index 6e5a103..557657c 100644
--- a/libmultipath/structs.c
+++ b/libmultipath/structs.c
@@ -101,6 +101,7 @@ alloc_path (void)
@ -60,10 +60,10 @@ index 464596f..e5de0a7 100644
checker_clear(&pp->checker);
dm_path_to_gen(pp)->ops = &dm_gen_path_ops;
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
index 7de93d6..022ba12 100644
index 399540e..ec12660 100644
--- a/libmultipath/structs.h
+++ b/libmultipath/structs.h
@@ -280,6 +280,7 @@ struct path {
@@ -310,6 +310,7 @@ struct path {
struct checker checker;
struct multipath * mpp;
int fd;
@ -72,14 +72,14 @@ index 7de93d6..022ba12 100644
int retriggers;
unsigned int path_failures;
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 8895fa7..8676081 100644
index 85d97ac..8170150 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -738,6 +738,7 @@ int verify_paths(struct multipath *mpp)
@@ -718,6 +718,7 @@ int verify_paths(struct multipath *mpp)
return 0;
vector_foreach_slot (mpp->paths, pp, i) {
+ pp->handled = 1;
+ pp->handled = 1;
/*
* see if path is in sysfs
*/

View File

@ -1,26 +1,21 @@
From 5ebbef9c1f3ae72efe7f9582532a346227a0a1a3 Mon Sep 17 00:00:00 2001
From 1c49c790c50452564b7319b2a427462ad266793f 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
Subject: [PATCH 07/15] fix lun expansion failure when there is offline path
---
libmultipath/configure.c | 20 +++++++++++++++-----
libmultipath/configure.c | 10 ++++++++++
libmultipath/structs_vec.c | 5 +++--
2 files changed, 18 insertions(+), 7 deletions(-)
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
index ff65c1b..e616da2 100644
index fdf8005..84a246b 100644
--- a/libmultipath/configure.c
+++ b/libmultipath/configure.c
@@ -1203,11 +1203,18 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
@@ -1187,6 +1187,13 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
orphan_path(pp1, "only one path");
continue;
}
- /* if path is handled before */
- if (pp1->handled) {
- condlog(3, "%s: skip handled path.", pp1->dev_t);
- continue;
- }
+
+ /* if path is offline */
+ if (pp1->state == PATH_DOWN) {
@ -28,15 +23,10 @@ index ff65c1b..e616da2 100644
+ continue;
+ }
+
+ /* if path is handled before */
+ if (pp1->handled) {
+ condlog(3, "%s: skip handled path.", pp1->dev_t);
+ continue;
+ }
/*
@@ -1235,6 +1242,9 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
/* if path is handled before */
if (pp1->handled) {
condlog(3, "%s: skip handled path.", pp1->dev_t);
@@ -1219,6 +1226,9 @@ int coalesce_paths (struct vectors *vecs, vector mpvec, char *refwwid,
if (strcmp(pp1->wwid, pp2->wwid))
continue;
@ -47,10 +37,10 @@ index ff65c1b..e616da2 100644
mpp->size = pp2->size;
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 8676081..0300add 100644
index 8170150..adc034b 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -742,8 +742,9 @@ int verify_paths(struct multipath *mpp)
@@ -722,8 +722,9 @@ int verify_paths(struct multipath *mpp)
/*
* see if path is in sysfs
*/

View File

@ -1,7 +1,7 @@
From a4485f642dc3f07f9f61245f4a5de559d3193649 Mon Sep 17 00:00:00 2001
From daa16263754c3fc439f16c89608436f00150e1cb Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 01:57:33 -0500
Subject: [PATCH] fix bugs backported from next branch
Subject: [PATCH 08/15] fix bugs backported from next branch
reason:fix bugs backported from next branch
---
@ -13,26 +13,26 @@ reason:fix bugs backported from next branch
5 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c
index 0ab06e2..e65b6f5 100644
index 0ab06e2..a6307d6 100644
--- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c
@@ -131,15 +131,19 @@ int getprio (struct path * pp, char * args, unsigned int timeout)
switch(-rc) {
case ALUA_PRIO_NOT_SUPPORTED:
condlog(0, "%s: alua not supported", pp->dev);
+ rc = 0;
+ rc = 0;
break;
case ALUA_PRIO_RTPG_FAILED:
condlog(0, "%s: couldn't get target port group", pp->dev);
+ rc = 0;
+ rc = 0;
break;
case ALUA_PRIO_GETAAS_FAILED:
condlog(0, "%s: couldn't get asymmetric access state", pp->dev);
+ rc = 0;
+ rc = 0;
break;
case ALUA_PRIO_TPGS_FAILED:
condlog(3, "%s: couldn't get supported alua states", pp->dev);
+ rc = 0;
+ rc = 0;
break;
}
}
@ -50,19 +50,19 @@ index 3b63cca..c40f88a 100644
memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
memset(&sense_buffer, 0, 128);
diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c
index 88cac5f..075751c 100644
index 88cac5f..45e1108 100644
--- a/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)
unsigned char *inqBuffp = inqBuff;
unsigned char sense_buffer[32];
sg_io_hdr_t io_hdr;
+ int ret = 0;
+ int ret = 0;
if ((ioctl (fd, SG_GET_VERSION_NUM, &k) < 0) || (k < 30000)) {
pp_hds_log(0, "can't use SG ioctl interface");
- return -1;
+ goto out;
+ goto out;
+
}
@ -72,12 +72,12 @@ index 88cac5f..075751c 100644
if (ioctl (fd, SG_IO, &io_hdr) < 0) {
pp_hds_log(0, "SG_IO error");
- return -1;
+ goto out;
+ goto out;
}
if ((io_hdr.info & SG_INFO_OK_MASK) != SG_INFO_OK) {
pp_hds_log(0, "SCSI error");
- return -1;
+ goto out;
+ goto out;
}
snprintf (vendor, 9, "%.8s", inqBuffp + 8);
@ -118,7 +118,7 @@ index 88cac5f..075751c 100644
int getprio (struct path * pp, __attribute__((unused)) char *args,
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
index 8895fa7..34ee661 100644
index adc034b..8873440 100644
--- a/libmultipath/structs_vec.c
+++ b/libmultipath/structs_vec.c
@@ -35,8 +35,10 @@ int update_mpp_paths(struct multipath *mpp, vector pathvec)
@ -127,24 +127,24 @@ index 8895fa7..34ee661 100644
if (!mpp->paths &&
- !(mpp->paths = vector_alloc()))
+ !(mpp->paths = vector_alloc())) {
+ condlog(2, "mpp->paths alloc failed");
+ condlog(2, "mpp->paths alloc failed");
return 1;
+ }
vector_foreach_slot (mpp->pg, pgp, i) {
vector_foreach_slot (pgp->paths, pp, j) {
diff --git a/multipathd/main.c b/multipathd/main.c
index a4abbb2..12459ab 100644
index 3aff241..02f368a 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -1725,6 +1725,11 @@ enable_group(struct path * pp)
@@ -1764,6 +1764,11 @@ enable_group(struct path * pp)
pgp = VECTOR_SLOT(pp->mpp->pg, pp->pgindex - 1);
+ if (!pgp) {
+ condlog(2, "%s: pgp is NULL", pp->mpp->alias);
+ return;
+ }
+ if (!pgp) {
+ condlog(2, "%s: pgp is NULL", pp->mpp->alias);
+ return;
+ }
+
if (pgp->status == PGSTATE_DISABLED) {
condlog(2, "%s: enable group #%i", pp->mpp->alias, pp->pgindex);

View File

@ -1,45 +0,0 @@
From 30ea73e8896765854fdf845fbb12b6eb85531527 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 02:21:31 -0500
Subject: [PATCH] fix change reservation key to uint8 for memcmp
reason:fix change reservation key to uint8 for memcmp
---
libmpathpersist/mpath_persist.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 1f9817e..557d582 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -249,6 +249,9 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
int ret;
uint64_t prkey;
struct config *conf;
+ uint8_t uitmp[8] = {0};
+ uint64_t uireservation = {0};
+ int j;
ret = mpath_get_map(fd, &alias, &mpp);
if (ret != MPATH_PR_SUCCESS)
@@ -274,8 +277,15 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
}
}
- if (memcmp(paramp->key, &mpp->reservation_key, 8) &&
- memcmp(paramp->sa_key, &mpp->reservation_key, 8)) {
+ uireservation = get_be64(mpp->reservation_key);
+ for (j = 7; j >= 0; --j) {
+ uitmp[j] = (uireservation & 0xff);
+ uireservation >>= 8;
+ }
+
+ if (memcmp(paramp->key, uitmp, 8) &&
+ memcmp(paramp->sa_key, uitmp, 8)) {
+
condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key));
ret = MPATH_PR_SYNTAX_ERROR;
goto out1;
--
1.8.3.1

View File

@ -0,0 +1,44 @@
From 1564c9c5f94dc23959f46e3061c33146a98523d2 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 02:21:31 -0500
Subject: [PATCH 09/15] fix change reservation key to uint8 for memcmp
reason:fix change reservation key to uint8 for memcmp
---
libmpathpersist/mpath_persist.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 803a2a2..a062920 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -275,6 +275,9 @@ static int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd,
int ret;
uint64_t prkey;
struct config *conf;
+ uint8_t uitmp[8] = {0};
+ uint64_t uireservation = {0};
+ int j;
ret = mpath_get_map(curmp, pathvec, fd, &alias, &mpp);
if (ret != MPATH_PR_SUCCESS)
@@ -301,8 +304,14 @@ static int do_mpath_persistent_reserve_out(vector curmp, vector pathvec, int fd,
}
}
- if (memcmp(paramp->key, &mpp->reservation_key, 8) &&
- memcmp(paramp->sa_key, &mpp->reservation_key, 8) &&
+ uireservation = get_be64(mpp->reservation_key);
+ for (j = 7; j >= 0; --j) {
+ uitmp[j] = (uireservation & 0xff);
+ uireservation >>= 8;
+ }
+
+ if (memcmp(paramp->key, uitmp, 8) &&
+ memcmp(paramp->sa_key, uitmp, 8) &&
(prkey || rq_servact != MPATH_PROUT_REG_IGN_SA)) {
condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key));
ret = MPATH_PR_SYNTAX_ERROR;
--
1.8.3.1

View File

@ -0,0 +1,30 @@
From 822769cf9509ebca9968ebd29a983271b24b1625 Mon Sep 17 00:00:00 2001
From: Lixiaokeng <lixiaokeng@huawei.com>
Date: Tue, 23 Nov 2021 21:16:19 +0800
Subject: [PATCH 10/15] bugfix flush and sync before reboot
---
libmultipath/util.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libmultipath/util.c b/libmultipath/util.c
index ea85840..dd32803 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -368,6 +368,13 @@ int safe_write(int fd, const void *buf, size_t count)
count -= r;
buf = (const char *)buf + r;
}
+
+ /* sync->disk */
+ if (fsync(fd) < 0) {
+ condlog(0, "failed to fsync fd :%d", fd);
+ return -errno;
+ }
+
return 0;
}
--
1.8.3.1

View File

@ -1,49 +0,0 @@
From 70ff8a11623a0a0e7677c597b5fb1846149d7de3 Mon Sep 17 00:00:00 2001
From: sunguoshuai <sunguoshuai@huawei.com>
Date: Wed, 23 Jan 2019 02:38:00 -0500
Subject: [PATCH] ignore for clear mismatch key
reason:ignore for clear mismatch key
---
libmpathpersist/mpath_persist.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
index 557d582..5a8c69d 100644
--- a/libmpathpersist/mpath_persist.c
+++ b/libmpathpersist/mpath_persist.c
@@ -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 &&
((!get_be64(mpp->reservation_key) &&
rq_servact == MPATH_PROUT_REG_SA) ||
- rq_servact == MPATH_PROUT_REG_IGN_SA)) {
+ rq_servact == MPATH_PROUT_REG_IGN_SA ||
+ (!memcmp(paramp->key, &mpp->reservation_key, 8) && rq_servact == MPATH_PROUT_REG_SA))) {
memcpy(&mpp->reservation_key, paramp->sa_key, 8);
if (update_prkey_flags(alias, get_be64(mpp->reservation_key),
paramp->sa_flags)) {
@@ -283,12 +284,16 @@ int __mpath_persistent_reserve_out ( int fd, int rq_servact, int rq_scope,
uireservation >>= 8;
}
- if (memcmp(paramp->key, uitmp, 8) &&
- memcmp(paramp->sa_key, uitmp, 8)) {
+ /* pass -I option */
+ if (rq_servact != MPATH_PROUT_REG_IGN_SA) {
+ if (memcmp(paramp->key, uitmp, 8) &&
+ memcmp(paramp->sa_key, uitmp, 8)) {
+ condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key));
+ ret = MPATH_PR_SYNTAX_ERROR;
+ goto out1;
+ }
+
- condlog(0, "%s: configured reservation key doesn't match: 0x%" PRIx64, alias, get_be64(mpp->reservation_key));
- ret = MPATH_PR_SYNTAX_ERROR;
- goto out1;
}
switch(rq_servact)
--
1.8.3.1

View File

@ -1,19 +0,0 @@
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -368,6 +368,13 @@ int safe_write(int fd, const void *buf, size_t count)
count -= r;
buf = (const char *)buf + r;
}
+
+ /* sync->disk */
+ if (fsync(fd) < 0) {
+ condlog(0, "failed to fsync fd :%d", fd);
+ return -errno;
+ }
+
return 0;
}
--
1.8.3.1

View File

@ -1,15 +1,15 @@
From a0cb1bf53c2a2b4089b98d3c811845517c95c6f5 Mon Sep 17 00:00:00 2001
From 2124943524470f9122a99e6b72c1946c0db3f7f0 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 22 Mar 2019 19:37:43 +0800
Subject: [PATCH] change log level to info if alua is not support by storage
server
Subject: [PATCH 11/15] change log level to info if alua is not support by
storage server
---
libmultipath/prioritizers/alua.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c
index e65b6f5..97eb152 100644
index a6307d6..8460848 100644
--- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c
@@ -130,7 +130,7 @@ int getprio (struct path * pp, char * args, unsigned int timeout)
@ -18,7 +18,7 @@ index e65b6f5..97eb152 100644
case ALUA_PRIO_NOT_SUPPORTED:
- condlog(0, "%s: alua not supported", pp->dev);
+ condlog(3, "%s: alua not supported", pp->dev);
rc = 0;
rc = 0;
break;
case ALUA_PRIO_RTPG_FAILED:
--

View File

@ -1,7 +1,7 @@
From eba371974dc9343740ff3b3fd18caab8529291d1 Mon Sep 17 00:00:00 2001
From 7462caa4d81facc941bde362113c05ab4c4f04d7 Mon Sep 17 00:00:00 2001
From: openEuler Buildteam <buildteam@openeuler.org>
Date: Thu, 2 Jan 2020 15:34:13 +0800
Subject: [PATCH] device-mapper-multipath: fix find multipath failure
Subject: [PATCH 12/15] device-mapper-multipath: fix find multipath failure
when DEFAULT_FIND_MULTIPATHS is FIND_MULTIPATHS_STRICT, it fail to
find multipath in find_multipaths function, use FIND_MULTIPATHS_OFF
@ -11,10 +11,10 @@ instead of FIND_MULTIPATHS_STRICT.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
index 7f3839f..c84d31d 100644
index c27946c..e0dd32a 100644
--- a/libmultipath/defaults.h
+++ b/libmultipath/defaults.h
@@ -17,7 +17,7 @@
@@ -23,7 +23,7 @@
#define DEFAULT_NO_PATH_RETRY NO_PATH_RETRY_UNDEF
#define DEFAULT_VERBOSITY 2
#define DEFAULT_REASSIGN_MAPS 0

View File

@ -1,7 +1,7 @@
From 57e2c5ddceb461c00bc42c8cb2fd45665838e6d1 Mon Sep 17 00:00:00 2001
From 021d7687e208d0e01feec945bbde5ff0a5557463 Mon Sep 17 00:00:00 2001
From: wangjufeng <wangjufeng@huawei.com>
Date: Fri, 10 Jan 2020 11:57:08 +0800
Subject: [PATCH] kpartx: change kpartx file and default bindir
Subject: [PATCH 13/15] kpartx: change kpartx file and default bindir
Change default bindir of multipath to /usr/sbin. Don't
set device name-partition number delimiter in kpartx rules.
@ -13,10 +13,10 @@ Signed-off-by: wangjufeng <wangjufeng@huawei.com>
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index f4d895d..0b083eb 100644
index 9944aa1..9913e7a 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -51,7 +51,7 @@ ifndef SYSTEMDPATH
@@ -53,7 +53,7 @@ ifndef SYSTEMDPATH
endif
prefix =

View File

@ -1,23 +1,24 @@
From a448fe41073d613764b8988d1e22ee0c6e7e3f92 Mon Sep 17 00:00:00 2001
From a31fb57aff527b5304c9a1cb1bd729317280abdd Mon Sep 17 00:00:00 2001
From: chenminhua <chenminhua1@huawei.com>
Date: Mon, 2 Apr 2018 04:01:04 -0400
Subject: [PATCH] remove local path
Subject: [PATCH 14/15] remove local disk from pathvec
[Changelog]:add upgrade path
[Author]:chenminhua
---
libmultipath/discovery.c | 128 ++++++++++++++++++++++++++++++++++++++++++++---
libmultipath/discovery.h | 1 +
multipathd/main.c | 4 ++
3 files changed, 127 insertions(+), 6 deletions(-)
libmultipath/discovery.c | 128 ++++++++++++++++++++++++++++++++++++--
libmultipath/discovery.h | 1 +
libmultipath/libmultipath.version | 1 +
multipathd/main.c | 4 ++
4 files changed, 128 insertions(+), 6 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index c2e1754..24e9b50 100644
index f25fe9e..72982ac 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -36,6 +36,103 @@
#include "configure.h"
@@ -37,6 +37,103 @@
#include "print.h"
#include "strbuf.h"
+const char *conf_file = "/etc/multipath_private.conf";
+static int conf_file_parsed = 0;
@ -119,7 +120,7 @@ index c2e1754..24e9b50 100644
struct vpd_vendor_page vpd_vendor_pages[VPD_VP_ARRAY_SIZE] = {
[VPD_VP_UNDEF] = { 0x00, "undef" },
[VPD_VP_HP3PAR] = { 0xc0, "hp3par" },
@@ -127,22 +224,35 @@ path_discover (vector pathvec, struct config * conf,
@@ -128,22 +225,35 @@ path_discover (vector pathvec, struct config * conf,
{
struct path *pp;
char devt[BLK_DEV_SIZE];
@ -161,7 +162,7 @@ index c2e1754..24e9b50 100644
}
static void cleanup_udev_enumerate_ptr(void *arg)
@@ -2138,6 +2248,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
@@ -2284,6 +2394,12 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
if (rc != PATHINFO_OK)
return rc;
@ -175,22 +176,34 @@ index c2e1754..24e9b50 100644
pp->sg_id.proto_id == SCSI_PROTOCOL_USB &&
!conf->allow_usb_devices) {
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 6444887..a438b44 100644
index a5446b4..26b6db1 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -56,6 +56,7 @@ int sysfs_get_asymmetric_access_state(struct path *pp,
char *buff, int buflen);
@@ -58,6 +58,7 @@ bool has_uid_fallback(struct path *pp);
int get_uid(struct path * pp, int path_state, struct udev_device *udev,
int allow_fallback);
bool is_vpd_page_supported(int fd, int pg);
+int remove_local_path(vector pathvec, struct path *pp);
/*
* discovery bitmask
diff --git a/libmultipath/libmultipath.version b/libmultipath/libmultipath.version
index eb5b5b5..bccf3f3 100644
--- a/libmultipath/libmultipath.version
+++ b/libmultipath/libmultipath.version
@@ -142,6 +142,7 @@ global:
recv_packet_from_client;
reinstate_paths;
remember_wwid;
+ remove_local_path;
remove_map;
remove_map_by_alias;
remove_maps;
diff --git a/multipathd/main.c b/multipathd/main.c
index 12459ab..0b572ee 100644
index 02f368a..47ca1b5 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -964,6 +964,10 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
@@ -1035,6 +1035,10 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int start_waiter = 0;
int ret;

View File

@ -1,8 +1,8 @@
From dd0c8768be8605040100cf8260f6b1405c264ffe Mon Sep 17 00:00:00 2001
From c6530acb0a5ed3acb8ad930ef9e54a27c17d1521 Mon Sep 17 00:00:00 2001
From: root <root@localhost.localdomain>
Date: Fri, 22 Mar 2019 19:48:35 +0800
Subject: [PATCH] clear mpp path reference when path is freed, otherwise double
free may occur in verify_paths.
Subject: [PATCH 15/15] clear mpp path reference when path is freed, otherwise
double free may occur in verify_paths.
call stack:
vecs=vecs@entry=0x557b01d62140, rpvec=rpvec@entry=0x0) at structs_vec.c:521
@ -17,10 +17,10 @@ call stack:
3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 24e9b50..b5cbc88 100644
index 72982ac..2144447 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -114,7 +114,7 @@ transport (int h)
@@ -115,7 +115,7 @@ transport (int h)
}
int
@ -29,7 +29,7 @@ index 24e9b50..b5cbc88 100644
{
int i = -1;
@@ -129,7 +129,9 @@ remove_local_path (vector pathvec, struct path *pp)
@@ -130,7 +130,9 @@ remove_local_path (vector pathvec, struct path *pp)
if ((i = find_slot(pathvec, (void *)pp)) != -1) {
vector_del_slot(pathvec, i);
}
@ -40,7 +40,7 @@ index 24e9b50..b5cbc88 100644
return 0;
}
@@ -237,7 +239,7 @@ path_discover (vector pathvec, struct config * conf,
@@ -238,7 +240,7 @@ path_discover (vector pathvec, struct config * conf,
if (err == 1)
return 1;
if (err == 0)
@ -49,7 +49,7 @@ index 24e9b50..b5cbc88 100644
return 0;
}
else {
@@ -250,7 +252,7 @@ path_discover (vector pathvec, struct config * conf,
@@ -251,7 +253,7 @@ path_discover (vector pathvec, struct config * conf,
if (err)
return err;
@ -59,24 +59,24 @@ index 24e9b50..b5cbc88 100644
}
}
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index a438b44..ab73493 100644
index 26b6db1..d51bc0e 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -56,7 +56,7 @@ int sysfs_get_asymmetric_access_state(struct path *pp,
char *buff, int buflen);
@@ -58,7 +58,7 @@ bool has_uid_fallback(struct path *pp);
int get_uid(struct path * pp, int path_state, struct udev_device *udev,
int allow_fallback);
bool is_vpd_page_supported(int fd, int pg);
-int remove_local_path(vector pathvec, struct path *pp);
+int remove_local_path(vector pathvec, struct path *pp, int isfree);
/*
* discovery bitmask
diff --git a/multipathd/main.c b/multipathd/main.c
index 0b572ee..a10eba0 100644
index 47ca1b5..118dadd 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -813,6 +813,21 @@ ev_remove_map (char * devname, char * alias, int minor, struct vectors * vecs)
return flush_map(mpp, vecs, 0);
@@ -884,6 +884,21 @@ check_path_wwid_change(struct path *pp)
return false;
}
+static
@ -97,7 +97,7 @@ index 0b572ee..a10eba0 100644
static int
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)
@@ -975,6 +990,7 @@ uev_add_path (struct uevent *uev, struct vectors * vecs, int need_do_map)
i = find_slot(vecs->pathvec, (void *)pp);
if (i != -1)
vector_del_slot(vecs->pathvec, i);
@ -105,7 +105,7 @@ index 0b572ee..a10eba0 100644
free_path(pp);
} else {
condlog(0, "%s: failed to reinitialize path",
@@ -965,8 +981,11 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
@@ -1036,8 +1052,11 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int ret;
/* if pp is local path,remove it and return 0. */
@ -118,7 +118,7 @@ index 0b572ee..a10eba0 100644
/*
* need path UID to go any further
@@ -981,6 +1000,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
@@ -1052,6 +1071,7 @@ ev_add_path (struct path * pp, struct vectors * vecs, int need_do_map)
int i = find_slot(vecs->pathvec, (void *)pp);
if (i != -1)
vector_del_slot(vecs->pathvec, i);
@ -126,7 +126,7 @@ index 0b572ee..a10eba0 100644
free_path(pp);
return 1;
}
@@ -1242,6 +1262,8 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
@@ -1305,6 +1325,8 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map)
/* mpp == NULL */
if ((i = find_slot(vecs->pathvec, (void *)pp)) != -1)
vector_del_slot(vecs->pathvec, i);

View File

@ -1,35 +0,0 @@
From faff5affb1ec7772d7d5c9ceaf1244b35ed12327 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Thu, 2 Sep 2021 16:57:48 -0500
Subject: [PATCH] libmultipath: deal with dynamic PTHREAD_STACK_MIN
Starting in glibc-2.34 (commit 5d98a7da), PTHREAD_STACK_MIN is defined
as sysconf(_SC_THREAD_STACK_MIN) if _GNU_SOURCE is defined. sysconf()
returns a long and can, at least in theory, return -1. This change
causes compilation to fail in setup_thread_attr() due to a comparision
with different signedness, since stacksize is a size_t.
Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libmultipath/util.c b/libmultipath/util.c
index baebb81..cc10543 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -223,8 +223,8 @@ setup_thread_attr(pthread_attr_t *attr, size_t stacksize, int detached)
ret = pthread_attr_init(attr);
assert(ret == 0);
- if (stacksize < PTHREAD_STACK_MIN)
- stacksize = PTHREAD_STACK_MIN;
+ if (PTHREAD_STACK_MIN > 0 && stacksize < (size_t)PTHREAD_STACK_MIN)
+ stacksize = (size_t)PTHREAD_STACK_MIN;
ret = pthread_attr_setstacksize(attr, stacksize);
assert(ret == 0);
if (detached) {
--
1.8.3.1

Binary file not shown.

BIN
multipath-tools-0.8.7.tgz Normal file

Binary file not shown.

View File

@ -1,31 +1,29 @@
#needsrootforbuild
Name: multipath-tools
Version: 0.8.5
Release: 7
Version: 0.8.7
Release: 1
Summary: Tools to manage multipath devices with the device-mapper
License: GPL-2.0-or-later and LGPL-2.0-only
URL: http://christophe.varoqui.free.fr/
# curl https://github.com/opensvc/multipath-tools/archive/0.8.5.tar.gz -o multipath-tools-0.8.5.tgz
Source0: multipath-tools-0.8.5.tgz
# curl https://github.com/opensvc/multipath-tools/archive/0.8.7.tar.gz -o multipath-tools-0.8.7.tgz
Source0: multipath-tools-0.8.7.tgz
Source1: multipath.conf
Patch1: 0001-change-order-of-multipath.rules.patch
Patch2: 0002-RH-add-mpathconf.patch
Patch3: 0003-RH-Remove-the-property-blacklist-exception-builtin.patch
Patch4: 0004-fix-syntax-error.patch
Patch5: 0005-fix-multipathd-resize-when-not-all-paths-size-are-equal.patch
Patch5: 0005-fix-multipathd-resize-when-not-all-paths-size-are-eq.patch
Patch6: 0006-avoid-handling-paths-repeatedly-in-coalesce-paths.patch
Patch7: 0007-bugfix-lun-expansion-failure-when-there-is-offline-path.patch
Patch7: 0007-fix-lun-expansion-failure-when-there-is-offline-path.patch
Patch8: 0008-fix-bugs-backported-from-next-branch.patch
Patch9: 0009-bugfix-change-reservation-key-to-uint8-for-memcmp.patch
Patch10: 0010-ignore-for-clear-mismatch-key.patch
Patch11: 0011-bugfix-flush-and-sync-before-reboot.patch
Patch12: 0012-change-log-level-to-info-if-alua-is-not-support-by-s.patch
Patch13: 0013-fix-find-multipath-failure.patch
Patch14: 0014-kpartx-change-kpartx-file-and-default-bindir.patch
Patch15: 0015-bugfix-RH-remove-local-disk-from-pathvec.patch
Patch16: 0016-bugfix-clear-mpp-path-reference-when-path-is-freed-otherwis.patch
Patch17: 0017-libmultipath-deal-with-dynamic-PTHREAD_STACK_MIN.patch
Patch9: 0009-fix-change-reservation-key-to-uint8-for-memcmp.patch
Patch10: 0010-bugfix-flush-and-sync-before-reboot.patch
Patch11: 0011-change-log-level-to-info-if-alua-is-not-support-by-s.patch
Patch12: 0012-device-mapper-multipath-fix-find-multipath-failure.patch
Patch13: 0013-kpartx-change-kpartx-file-and-default-bindir.patch
Patch14: 0014-remove-local-disk-from-pathvec.patch
Patch15: 0015-clear-mpp-path-reference-when-path-is-freed-otherwis.patch
BuildRequires: multipath-tools, libcmocka, libcmocka-devel
BuildRequires: gcc, libaio-devel, userspace-rcu-devel, device-mapper-devel >= 1.02.89
@ -83,7 +81,7 @@ Summary: Create device maps from partition tables.
Reads partition tables and create device maps over partitions segments detected.
%prep
%autosetup -n multipath-tools-0.8.5 -p1
%autosetup -n multipath-tools-0.8.7 -p1
cp %{SOURCE1} .
%build
@ -137,6 +135,8 @@ fi
/usr/%{_lib}/libmpathpersist.so.*
/usr/%{_lib}/libmpathcmd.so.*
/usr/%{_lib}/libdmmp.so.*
/usr/%{_lib}/libmpathvalid.so
/usr/%{_lib}/libmpathvalid.so.*
%dir /etc/multipath
%dir /usr/%{_lib}/multipath
/usr/%{_lib}/multipath/*
@ -170,6 +170,9 @@ fi
%changelog
* Tue Nov 23 2021 lixiaokeng<lixiaokeng@huawei.com> - 0.8.7-1
- upgrade to 0.8.7
* Fri Sep 24 2021 lixiaokeng<lixiaokeng@huawei.com> - 0.8.5-7
- Type:codeclean
- ID:NA