device-mapper-multipath-0.8.4-4
Rebased on top of additional commits staged for upstream * Previous patches 0048-0060 are now patches 0053-0054 & 0059-0069 Add 0048-libmultipath-add-device-to-hwtable.c.patch Add 0049-master-libmultipath-fix-use-after-free-when-iscsi-lo.patch Add 0050-libmultipath-warn-if-freeing-path-that-holds-mpp-hwe.patch Add 0051-libmultipath-warn-about-NULL-value-of-mpp-hwe.patch Add 0052-libmultipath-fix-mpp-hwe-handling-in-sync_paths.patch Add 0055-libmultipath-remove-code-duplication-in-path-countin.patch Add 0056-libmultipath-count-pending-paths-as-active-on-loads.patch Add 0057-libmultipath-deal-with-flushing-no-maps.patch Add 0058-multipath-deal-with-delegation-failures-correctly.patch Add 0070-multipath-add-libmpathvalid-library.patch * adds the libmpathvalid.so library to determine if devices are valid multipath paths. Add 0071-libmultipath-add-uid-failback-for-dasd-devices.patch Add 0072-libmultipath-add-ignore_udev_uid-option.patch
This commit is contained in:
parent
f478b960f2
commit
9abdc502cf
44
0048-libmultipath-add-device-to-hwtable.c.patch
Normal file
44
0048-libmultipath-add-device-to-hwtable.c.patch
Normal file
@ -0,0 +1,44 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Steve Schremmer <steve.schremmer@netapp.com>
|
||||
Date: Mon, 6 Jul 2020 20:22:35 +0000
|
||||
Subject: [PATCH] libmultipath: add device to hwtable.c
|
||||
|
||||
Add FUJITSU ETERNUS_AHB defaults.
|
||||
|
||||
Signed-off-by: Steve Schremmer <steve.schremmer@netapp.com>
|
||||
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/hwtable.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/libmultipath/hwtable.c b/libmultipath/hwtable.c
|
||||
index d1fcfdb3..d680bdfc 100644
|
||||
--- a/libmultipath/hwtable.c
|
||||
+++ b/libmultipath/hwtable.c
|
||||
@@ -428,6 +428,22 @@ static struct hwentry default_hw[] = {
|
||||
.pgpolicy = MULTIBUS,
|
||||
.no_path_retry = 10,
|
||||
},
|
||||
+ {
|
||||
+ /*
|
||||
+ * ETERNUS AB/HB
|
||||
+ * Maintainer: NetApp RDAC team <ng-eseries-upstream-maintainers@netapp.com>
|
||||
+ */
|
||||
+ .vendor = "FUJITSU",
|
||||
+ .product = "ETERNUS_AHB",
|
||||
+ .bl_product = "Universal Xport",
|
||||
+ .pgpolicy = GROUP_BY_PRIO,
|
||||
+ .checker_name = RDAC,
|
||||
+ .features = "2 pg_init_retries 50",
|
||||
+ .hwhandler = "1 rdac",
|
||||
+ .prio_name = PRIO_RDAC,
|
||||
+ .pgfailback = -FAILBACK_IMMEDIATE,
|
||||
+ .no_path_retry = 30,
|
||||
+ },
|
||||
/*
|
||||
* Hitachi Vantara
|
||||
*
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,84 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: lixiaokeng <lixiaokeng@huawei.com>
|
||||
Date: Mon, 13 Jul 2020 13:07:40 +0200
|
||||
Subject: [PATCH] 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>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/structs_vec.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
|
||||
index 8137ea21..430eaad7 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;
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Mon, 13 Jul 2020 13:07:41 +0200
|
||||
Subject: [PATCH] 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>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.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 430eaad7..cde4dbe6 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;
|
||||
--
|
||||
2.17.2
|
||||
|
33
0051-libmultipath-warn-about-NULL-value-of-mpp-hwe.patch
Normal file
33
0051-libmultipath-warn-about-NULL-value-of-mpp-hwe.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Mon, 13 Jul 2020 13:07:42 +0200
|
||||
Subject: [PATCH] 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>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/propsel.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
|
||||
index d362beb4..68228272 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; \
|
||||
}
|
||||
--
|
||||
2.17.2
|
||||
|
45
0052-libmultipath-fix-mpp-hwe-handling-in-sync_paths.patch
Normal file
45
0052-libmultipath-fix-mpp-hwe-handling-in-sync_paths.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Martin Wilck <mwilck@suse.com>
|
||||
Date: Mon, 13 Jul 2020 13:07:43 +0200
|
||||
Subject: [PATCH] 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>
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/structs_vec.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
|
||||
index cde4dbe6..ede14297 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);
|
||||
}
|
||||
|
||||
int
|
||||
--
|
||||
2.17.2
|
||||
|
129
0055-libmultipath-remove-code-duplication-in-path-countin.patch
Normal file
129
0055-libmultipath-remove-code-duplication-in-path-countin.patch
Normal file
@ -0,0 +1,129 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 21 Jul 2020 01:12:05 -0500
|
||||
Subject: [PATCH] libmultipath: remove code duplication in path counting
|
||||
|
||||
pathcountgr() is never used except by pathcount(), and neither is the
|
||||
special case for PATH_WILD. Simplify this and make one function that is
|
||||
used by both pathcount() and count_active_paths(). This will be used
|
||||
again in a future patch.
|
||||
|
||||
Also use count_active_paths() in mpath_persist.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmpathpersist/mpath_persist.c | 4 +--
|
||||
libmultipath/structs.c | 47 +++++++++++++--------------------
|
||||
libmultipath/structs.h | 1 -
|
||||
3 files changed, 21 insertions(+), 31 deletions(-)
|
||||
|
||||
diff --git a/libmpathpersist/mpath_persist.c b/libmpathpersist/mpath_persist.c
|
||||
index 3da7a6cf..a132f4e9 100644
|
||||
--- a/libmpathpersist/mpath_persist.c
|
||||
+++ b/libmpathpersist/mpath_persist.c
|
||||
@@ -436,7 +436,7 @@ int mpath_prout_reg(struct multipath *mpp,int rq_servact, int rq_scope,
|
||||
|
||||
all_tg_pt = (mpp->all_tg_pt == ALL_TG_PT_ON ||
|
||||
paramp->sa_flags & MPATH_F_ALL_TG_PT_MASK);
|
||||
- active_pathcount = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST);
|
||||
+ active_pathcount = count_active_paths(mpp);
|
||||
|
||||
if (active_pathcount == 0) {
|
||||
condlog (0, "%s: no path available", mpp->wwid);
|
||||
@@ -648,7 +648,7 @@ int mpath_prout_rel(struct multipath *mpp,int rq_servact, int rq_scope,
|
||||
if (!mpp)
|
||||
return MPATH_PR_DMMP_ERROR;
|
||||
|
||||
- active_pathcount = pathcount (mpp, PATH_UP) + pathcount (mpp, PATH_GHOST);
|
||||
+ active_pathcount = count_active_paths(mpp);
|
||||
|
||||
struct threadinfo thread[active_pathcount];
|
||||
memset(thread, 0, sizeof(thread));
|
||||
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
|
||||
index 2dd378c4..3eac3d61 100644
|
||||
--- a/libmultipath/structs.c
|
||||
+++ b/libmultipath/structs.c
|
||||
@@ -455,49 +455,40 @@ find_path_by_devt (const struct _vector *pathvec, const char * dev_t)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-int pathcountgr(const struct pathgroup *pgp, int state)
|
||||
+static int do_pathcount(const struct multipath *mpp, const int *states,
|
||||
+ unsigned int nr_states)
|
||||
{
|
||||
+ struct pathgroup *pgp;
|
||||
struct path *pp;
|
||||
int count = 0;
|
||||
- int i;
|
||||
+ unsigned int i, j, k;
|
||||
|
||||
- vector_foreach_slot (pgp->paths, pp, i)
|
||||
- if ((pp->state == state) || (state == PATH_WILD))
|
||||
- count++;
|
||||
+ if (!mpp->pg || !nr_states)
|
||||
+ return count;
|
||||
|
||||
+ vector_foreach_slot (mpp->pg, pgp, i) {
|
||||
+ vector_foreach_slot (pgp->paths, pp, j) {
|
||||
+ for (k = 0; k < nr_states; k++) {
|
||||
+ if (pp->state == states[k]) {
|
||||
+ count++;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
return count;
|
||||
}
|
||||
|
||||
int pathcount(const struct multipath *mpp, int state)
|
||||
{
|
||||
- struct pathgroup *pgp;
|
||||
- int count = 0;
|
||||
- int i;
|
||||
-
|
||||
- if (mpp->pg) {
|
||||
- vector_foreach_slot (mpp->pg, pgp, i)
|
||||
- count += pathcountgr(pgp, state);
|
||||
- }
|
||||
- return count;
|
||||
+ return do_pathcount(mpp, &state, 1);
|
||||
}
|
||||
|
||||
int count_active_paths(const struct multipath *mpp)
|
||||
{
|
||||
- struct pathgroup *pgp;
|
||||
- struct path *pp;
|
||||
- int count = 0;
|
||||
- int i, j;
|
||||
-
|
||||
- if (!mpp->pg)
|
||||
- return 0;
|
||||
+ int states[] = {PATH_UP, PATH_GHOST};
|
||||
|
||||
- vector_foreach_slot (mpp->pg, pgp, i) {
|
||||
- vector_foreach_slot (pgp->paths, pp, j) {
|
||||
- if (pp->state == PATH_UP || pp->state == PATH_GHOST)
|
||||
- count++;
|
||||
- }
|
||||
- }
|
||||
- return count;
|
||||
+ return do_pathcount(mpp, states, 2);
|
||||
}
|
||||
|
||||
int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp)
|
||||
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
||||
index d69bc2e9..0c03e711 100644
|
||||
--- a/libmultipath/structs.h
|
||||
+++ b/libmultipath/structs.h
|
||||
@@ -446,7 +446,6 @@ struct path * find_path_by_devt (const struct _vector *pathvec, const char *devt
|
||||
struct path * find_path_by_dev (const struct _vector *pathvec, const char *dev);
|
||||
struct path * first_path (const struct multipath *mpp);
|
||||
|
||||
-int pathcountgr (const struct pathgroup *, int);
|
||||
int pathcount (const struct multipath *, int);
|
||||
int count_active_paths(const struct multipath *);
|
||||
int pathcmp (const struct pathgroup *, const struct pathgroup *);
|
||||
--
|
||||
2.17.2
|
||||
|
@ -0,0 +1,73 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 21 Jul 2020 01:19:30 -0500
|
||||
Subject: [PATCH] libmultipath: count pending paths as active on loads
|
||||
|
||||
When multipath loads a table, it signals to udev if there are no active
|
||||
paths. Multipath wasn't counting pending paths as active. This meant
|
||||
that if all the paths were pending, udev would treat the device as not
|
||||
ready, and not run kpartx on it. Even if the pending paths later
|
||||
because active and were reinstated, the kernel would not send a new
|
||||
uevent, because from its point of view, they were always up.
|
||||
|
||||
The alternative would be to continue to treat them as failed in the udev
|
||||
rules, but then also tell the kernel that they were down, so that it
|
||||
would trigger a uevent when they were reinstated. However, this could
|
||||
lead to newly created multipath devices failing IO, simply because the
|
||||
path checkers hadn't returned yet. Having udev assume that the the
|
||||
device is up, like the kernel does, seems like the safer option.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/devmapper.c | 3 ++-
|
||||
libmultipath/structs.c | 7 +++++++
|
||||
libmultipath/structs.h | 1 +
|
||||
3 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
|
||||
index f597ff8b..126cd728 100644
|
||||
--- a/libmultipath/devmapper.c
|
||||
+++ b/libmultipath/devmapper.c
|
||||
@@ -417,7 +417,8 @@ static uint16_t build_udev_flags(const struct multipath *mpp, int reload)
|
||||
/* DM_UDEV_DISABLE_LIBRARY_FALLBACK is added in dm_addmap */
|
||||
return (mpp->skip_kpartx == SKIP_KPARTX_ON ?
|
||||
MPATH_UDEV_NO_KPARTX_FLAG : 0) |
|
||||
- ((count_active_paths(mpp) == 0 || mpp->ghost_delay_tick > 0) ?
|
||||
+ ((count_active_pending_paths(mpp) == 0 ||
|
||||
+ mpp->ghost_delay_tick > 0) ?
|
||||
MPATH_UDEV_NO_PATHS_FLAG : 0) |
|
||||
(reload && !mpp->force_udev_reload ?
|
||||
MPATH_UDEV_RELOAD_FLAG : 0);
|
||||
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
|
||||
index 3eac3d61..0d1f969d 100644
|
||||
--- a/libmultipath/structs.c
|
||||
+++ b/libmultipath/structs.c
|
||||
@@ -491,6 +491,13 @@ int count_active_paths(const struct multipath *mpp)
|
||||
return do_pathcount(mpp, states, 2);
|
||||
}
|
||||
|
||||
+int count_active_pending_paths(const struct multipath *mpp)
|
||||
+{
|
||||
+ int states[] = {PATH_UP, PATH_GHOST, PATH_PENDING};
|
||||
+
|
||||
+ return do_pathcount(mpp, states, 3);
|
||||
+}
|
||||
+
|
||||
int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp)
|
||||
{
|
||||
int i, j;
|
||||
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
|
||||
index 0c03e711..917e4083 100644
|
||||
--- a/libmultipath/structs.h
|
||||
+++ b/libmultipath/structs.h
|
||||
@@ -448,6 +448,7 @@ struct path * first_path (const struct multipath *mpp);
|
||||
|
||||
int pathcount (const struct multipath *, int);
|
||||
int count_active_paths(const struct multipath *);
|
||||
+int count_active_pending_paths(const struct multipath *);
|
||||
int pathcmp (const struct pathgroup *, const struct pathgroup *);
|
||||
int add_feature (char **, const char *);
|
||||
int remove_feature (char **, const char *);
|
||||
--
|
||||
2.17.2
|
||||
|
33
0057-libmultipath-deal-with-flushing-no-maps.patch
Normal file
33
0057-libmultipath-deal-with-flushing-no-maps.patch
Normal file
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 21 Jul 2020 01:28:22 -0500
|
||||
Subject: [PATCH] libmultipath: deal with flushing no maps
|
||||
|
||||
dm_flush_maps() was failing if there were no device-mapper devices at
|
||||
all, instead of returning success, since there is nothing to do.
|
||||
|
||||
Fixes: "libmultipath: make dm_flush_maps only return 0 on success"
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/devmapper.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c
|
||||
index 126cd728..b8199cb5 100644
|
||||
--- a/libmultipath/devmapper.c
|
||||
+++ b/libmultipath/devmapper.c
|
||||
@@ -1024,10 +1024,10 @@ int dm_flush_maps (int need_suspend, int retries)
|
||||
if (!(names = dm_task_get_names (dmt)))
|
||||
goto out;
|
||||
|
||||
+ r = 0;
|
||||
if (!names->dev)
|
||||
goto out;
|
||||
|
||||
- r = 0;
|
||||
do {
|
||||
if (need_suspend)
|
||||
r |= dm_suspend_and_flush_map(names->name, retries);
|
||||
--
|
||||
2.17.2
|
||||
|
39
0058-multipath-deal-with-delegation-failures-correctly.patch
Normal file
39
0058-multipath-deal-with-delegation-failures-correctly.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 21 Jul 2020 01:37:18 -0500
|
||||
Subject: [PATCH] multipath: deal with delegation failures correctly
|
||||
|
||||
delegate_to_multipathd() was returning success, even if the multipathd
|
||||
command failed. Also, if the command was set to fail with NOT_DELEGATED,
|
||||
it shouldn't print any errors, since multipath will try to issue to
|
||||
command itself.
|
||||
|
||||
Fixes: "multipath: delegate flushing maps to multipathd"
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
multipath/main.c | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/multipath/main.c b/multipath/main.c
|
||||
index 4c43314e..3da692dc 100644
|
||||
--- a/multipath/main.c
|
||||
+++ b/multipath/main.c
|
||||
@@ -861,9 +861,12 @@ int delegate_to_multipathd(enum mpath_cmds cmd,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- if (reply != NULL && *reply != '\0' && strcmp(reply, "ok\n"))
|
||||
- printf("%s", reply);
|
||||
- r = DELEGATE_OK;
|
||||
+ if (reply != NULL && *reply != '\0') {
|
||||
+ if (strcmp(reply, "fail\n"))
|
||||
+ r = DELEGATE_OK;
|
||||
+ if (r != NOT_DELEGATED && strcmp(reply, "ok\n"))
|
||||
+ printf("%s", reply);
|
||||
+ }
|
||||
|
||||
out:
|
||||
FREE(reply);
|
||||
--
|
||||
2.17.2
|
||||
|
@ -86,7 +86,7 @@ index 0c6ee54d..e32a0b0e 100644
|
||||
enum {
|
||||
WWID_IS_NOT_FAILED = 0,
|
||||
diff --git a/multipath/main.c b/multipath/main.c
|
||||
index 4c43314e..c73f6963 100644
|
||||
index 3da692dc..ce48a932 100644
|
||||
--- a/multipath/main.c
|
||||
+++ b/multipath/main.c
|
||||
@@ -135,7 +135,7 @@ usage (char * progname)
|
||||
@ -107,7 +107,7 @@ index 4c43314e..c73f6963 100644
|
||||
" -c check if a device should be a path in a multipath device\n"
|
||||
" -C check if a multipath device has usable paths\n"
|
||||
" -q allow queue_if_no_path when multipathd is not running\n"
|
||||
@@ -893,7 +895,7 @@ main (int argc, char *argv[])
|
||||
@@ -896,7 +898,7 @@ main (int argc, char *argv[])
|
||||
multipath_conf = conf;
|
||||
conf->retrigger_tries = 0;
|
||||
conf->force_sync = 1;
|
||||
@ -116,7 +116,7 @@ index 4c43314e..c73f6963 100644
|
||||
switch(arg) {
|
||||
case 1: printf("optarg : %s\n",optarg);
|
||||
break;
|
||||
@@ -970,6 +972,10 @@ main (int argc, char *argv[])
|
||||
@@ -973,6 +975,10 @@ main (int argc, char *argv[])
|
||||
case 'T':
|
||||
cmd = CMD_DUMP_CONFIG;
|
||||
break;
|
369
0070-multipath-add-libmpathvalid-library.patch
Normal file
369
0070-multipath-add-libmpathvalid-library.patch
Normal file
@ -0,0 +1,369 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Wed, 13 May 2020 17:04:24 -0500
|
||||
Subject: [PATCH] multipath: add libmpathvalid library
|
||||
|
||||
This library allows other programs to check if a path should be claimed
|
||||
by multipath. It exports an init and exit function, that need to be
|
||||
called before any other functions can be called, a pointer to a struct
|
||||
config, that stores the configuration which is dealt with in the
|
||||
init and exit functions, and two more functions.
|
||||
|
||||
mpath_get_mode() get the configured find_multipaths mode.
|
||||
mpath_is_path() returns whether the device is claimed by multipath, and
|
||||
optionally returns the wwid. This code works slightly different than
|
||||
the multipath -c/u code for SMART mode. Instead of checking all the
|
||||
existing paths to see if another has the same wwid, it expects the
|
||||
caller to pass in an array of the already known path wwids, and checks
|
||||
if the current path matches any of those.
|
||||
|
||||
The library also doesn't set up the device-mapper log fuctions. It
|
||||
leaves this up to the caller.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
Makefile | 3 +-
|
||||
Makefile.inc | 1 +
|
||||
libmpathvalid/Makefile | 38 +++++++
|
||||
libmpathvalid/libmpathvalid.version | 10 ++
|
||||
libmpathvalid/mpath_valid.c | 168 ++++++++++++++++++++++++++++
|
||||
libmpathvalid/mpath_valid.h | 57 ++++++++++
|
||||
6 files changed, 276 insertions(+), 1 deletion(-)
|
||||
create mode 100644 libmpathvalid/Makefile
|
||||
create mode 100644 libmpathvalid/libmpathvalid.version
|
||||
create mode 100644 libmpathvalid/mpath_valid.c
|
||||
create mode 100644 libmpathvalid/mpath_valid.h
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 8bcaba66..f157a549 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -9,6 +9,7 @@ BUILDDIRS := \
|
||||
libmultipath/checkers \
|
||||
libmultipath/foreign \
|
||||
libmpathpersist \
|
||||
+ libmpathvalid \
|
||||
multipath \
|
||||
multipathd \
|
||||
mpathpersist \
|
||||
@@ -29,7 +30,7 @@ $(BUILDDIRS):
|
||||
$(MAKE) -C $@
|
||||
|
||||
libmultipath libdmmp: libmpathcmd
|
||||
-libmpathpersist multipath multipathd: libmultipath
|
||||
+libmpathpersist libmpathvalid multipath multipathd: libmultipath
|
||||
mpathpersist multipathd: libmpathpersist
|
||||
|
||||
libmultipath/checkers.install \
|
||||
diff --git a/Makefile.inc b/Makefile.inc
|
||||
index e2f5d0dc..936e5833 100644
|
||||
--- a/Makefile.inc
|
||||
+++ b/Makefile.inc
|
||||
@@ -66,6 +66,7 @@ libdir = $(prefix)/$(LIB)/multipath
|
||||
unitdir = $(prefix)/$(SYSTEMDPATH)/systemd/system
|
||||
mpathpersistdir = $(TOPDIR)/libmpathpersist
|
||||
mpathcmddir = $(TOPDIR)/libmpathcmd
|
||||
+mpathvaliddir = $(TOPDIR)/libmpathvalid
|
||||
thirdpartydir = $(TOPDIR)/third-party
|
||||
libdmmpdir = $(TOPDIR)/libdmmp
|
||||
nvmedir = $(TOPDIR)/libmultipath/nvme
|
||||
diff --git a/libmpathvalid/Makefile b/libmpathvalid/Makefile
|
||||
new file mode 100644
|
||||
index 00000000..70b97eca
|
||||
--- /dev/null
|
||||
+++ b/libmpathvalid/Makefile
|
||||
@@ -0,0 +1,38 @@
|
||||
+include ../Makefile.inc
|
||||
+
|
||||
+SONAME = 0
|
||||
+DEVLIB = libmpathvalid.so
|
||||
+LIBS = $(DEVLIB).$(SONAME)
|
||||
+
|
||||
+CFLAGS += $(LIB_CFLAGS) -I$(multipathdir) -I$(mpathcmddir)
|
||||
+
|
||||
+LIBDEPS += -lpthread -ldevmapper -ldl -L$(multipathdir) \
|
||||
+ -lmultipath -L$(mpathcmddir) -lmpathcmd -ludev
|
||||
+
|
||||
+OBJS = mpath_valid.o
|
||||
+
|
||||
+all: $(LIBS)
|
||||
+
|
||||
+$(LIBS): $(OBJS)
|
||||
+ $(CC) $(LDFLAGS) $(SHARED_FLAGS) -Wl,-soname=$@ -o $@ $(OBJS) $(LIBDEPS) -Wl,--version-script=libmpathvalid.version
|
||||
+ $(LN) $(LIBS) $(DEVLIB)
|
||||
+
|
||||
+install: $(LIBS)
|
||||
+ $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(syslibdir)
|
||||
+ $(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
|
||||
+ $(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||||
+ $(INSTALL_PROGRAM) -m 755 -d $(DESTDIR)$(includedir)
|
||||
+ $(INSTALL_PROGRAM) -m 644 mpath_valid.h $(DESTDIR)$(includedir)
|
||||
+
|
||||
+uninstall:
|
||||
+ $(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
|
||||
+ $(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
|
||||
+ $(RM) $(DESTDIR)$(includedir)/mpath_valid.h
|
||||
+
|
||||
+clean: dep_clean
|
||||
+ $(RM) core *.a *.o *.so *.so.* *.gz
|
||||
+
|
||||
+include $(wildcard $(OBJS:.o=.d))
|
||||
+
|
||||
+dep_clean:
|
||||
+ $(RM) $(OBJS:.o=.d)
|
||||
diff --git a/libmpathvalid/libmpathvalid.version b/libmpathvalid/libmpathvalid.version
|
||||
new file mode 100644
|
||||
index 00000000..4d8a8ba4
|
||||
--- /dev/null
|
||||
+++ b/libmpathvalid/libmpathvalid.version
|
||||
@@ -0,0 +1,10 @@
|
||||
+MPATH_1.0 {
|
||||
+ global:
|
||||
+ mpathvalid_conf;
|
||||
+ mpathvalid_init;
|
||||
+ mpathvalid_exit;
|
||||
+ mpathvalid_is_path;
|
||||
+ mpathvalid_get_mode;
|
||||
+ local:
|
||||
+ *;
|
||||
+};
|
||||
diff --git a/libmpathvalid/mpath_valid.c b/libmpathvalid/mpath_valid.c
|
||||
new file mode 100644
|
||||
index 00000000..6153e8b7
|
||||
--- /dev/null
|
||||
+++ b/libmpathvalid/mpath_valid.c
|
||||
@@ -0,0 +1,168 @@
|
||||
+#include <stdlib.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdint.h>
|
||||
+#include <libdevmapper.h>
|
||||
+#include <libudev.h>
|
||||
+#include <errno.h>
|
||||
+
|
||||
+#include "devmapper.h"
|
||||
+#include "structs.h"
|
||||
+#include "util.h"
|
||||
+#include "config.h"
|
||||
+#include "discovery.h"
|
||||
+#include "wwids.h"
|
||||
+#include "sysfs.h"
|
||||
+#include "mpath_cmd.h"
|
||||
+#include "valid.h"
|
||||
+#include "mpath_valid.h"
|
||||
+
|
||||
+static struct config default_config = { .verbosity = -1 };
|
||||
+struct config *mpathvalid_conf = &default_config;
|
||||
+
|
||||
+static unsigned int get_conf_mode(struct config *conf)
|
||||
+{
|
||||
+ if (conf->find_multipaths == FIND_MULTIPATHS_SMART)
|
||||
+ return MPATH_SMART;
|
||||
+ if (conf->find_multipaths == FIND_MULTIPATHS_GREEDY)
|
||||
+ return MPATH_GREEDY;
|
||||
+ return MPATH_STRICT;
|
||||
+}
|
||||
+
|
||||
+static void set_conf_mode(struct config *conf, unsigned int mode)
|
||||
+{
|
||||
+ if (mode == MPATH_SMART)
|
||||
+ conf->find_multipaths = FIND_MULTIPATHS_SMART;
|
||||
+ else if (mode == MPATH_GREEDY)
|
||||
+ conf->find_multipaths = FIND_MULTIPATHS_GREEDY;
|
||||
+ else
|
||||
+ conf->find_multipaths = FIND_MULTIPATHS_STRICT;
|
||||
+}
|
||||
+
|
||||
+unsigned int mpathvalid_get_mode(void)
|
||||
+{
|
||||
+ int mode;
|
||||
+ struct config *conf;
|
||||
+
|
||||
+ conf = get_multipath_config();
|
||||
+ if (!conf)
|
||||
+ return -1;
|
||||
+ mode = get_conf_mode(conf);
|
||||
+ put_multipath_config(conf);
|
||||
+ return mode;
|
||||
+}
|
||||
+
|
||||
+static int convert_result(int result) {
|
||||
+ switch (result) {
|
||||
+ case PATH_IS_ERROR:
|
||||
+ return MPATH_IS_ERROR;
|
||||
+ case PATH_IS_NOT_VALID:
|
||||
+ return MPATH_IS_NOT_VALID;
|
||||
+ case PATH_IS_VALID:
|
||||
+ return MPATH_IS_VALID;
|
||||
+ case PATH_IS_VALID_NO_CHECK:
|
||||
+ return MPATH_IS_VALID_NO_CHECK;
|
||||
+ case PATH_IS_MAYBE_VALID:
|
||||
+ return MPATH_IS_MAYBE_VALID;
|
||||
+ }
|
||||
+ return MPATH_IS_ERROR;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+mpathvalid_init(int verbosity)
|
||||
+{
|
||||
+ unsigned int version[3];
|
||||
+ struct config *conf;
|
||||
+
|
||||
+ default_config.verbosity = verbosity;
|
||||
+ skip_libmp_dm_init();
|
||||
+ conf = load_config(DEFAULT_CONFIGFILE);
|
||||
+ if (!conf)
|
||||
+ return -1;
|
||||
+ conf->verbosity = verbosity;
|
||||
+ if (dm_prereq(version))
|
||||
+ goto fail;
|
||||
+ memcpy(conf->version, version, sizeof(version));
|
||||
+
|
||||
+ mpathvalid_conf = conf;
|
||||
+ return 0;
|
||||
+fail:
|
||||
+ free_config(conf);
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+mpathvalid_exit(void)
|
||||
+{
|
||||
+ struct config *conf = mpathvalid_conf;
|
||||
+
|
||||
+ default_config.verbosity = -1;
|
||||
+ if (mpathvalid_conf == &default_config)
|
||||
+ return 0;
|
||||
+ mpathvalid_conf = &default_config;
|
||||
+ free_config(conf);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * name: name of path to check
|
||||
+ * mode: mode to use for determination. MPATH_DEFAULT uses configured mode
|
||||
+ * info: on success, contains the path wwid
|
||||
+ * paths: array of the returned mpath_info from other claimed paths
|
||||
+ * nr_paths: the size of the paths array
|
||||
+ */
|
||||
+int
|
||||
+mpathvalid_is_path(const char *name, unsigned int mode, char **wwid,
|
||||
+ const char **path_wwids, unsigned int nr_paths)
|
||||
+{
|
||||
+ struct config *conf;
|
||||
+ int r = MPATH_IS_ERROR;
|
||||
+ unsigned int i;
|
||||
+ struct path *pp;
|
||||
+
|
||||
+ if (!name || mode >= MPATH_MAX_MODE)
|
||||
+ return r;
|
||||
+
|
||||
+ if (nr_paths > 0 && !path_wwids)
|
||||
+ return r;
|
||||
+
|
||||
+ pp = alloc_path();
|
||||
+ if (!pp)
|
||||
+ return r;
|
||||
+
|
||||
+ if (wwid) {
|
||||
+ *wwid = (char *)malloc(WWID_SIZE);
|
||||
+ if (!*wwid)
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ conf = get_multipath_config();
|
||||
+ if (!conf || conf == &default_config)
|
||||
+ goto out_wwid;
|
||||
+ if (mode != MPATH_DEFAULT)
|
||||
+ set_conf_mode(conf, mode);
|
||||
+ r = convert_result(is_path_valid(name, conf, pp, true));
|
||||
+ put_multipath_config(conf);
|
||||
+
|
||||
+ if (r == MPATH_IS_MAYBE_VALID) {
|
||||
+ for (i = 0; i < nr_paths; i++) {
|
||||
+ if (strncmp(path_wwids[i], pp->wwid, WWID_SIZE) == 0) {
|
||||
+ r = MPATH_IS_VALID;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+out_wwid:
|
||||
+ if (wwid) {
|
||||
+ if (r == MPATH_IS_VALID || r == MPATH_IS_VALID_NO_CHECK ||
|
||||
+ r == MPATH_IS_MAYBE_VALID)
|
||||
+ strlcpy(*wwid, pp->wwid, WWID_SIZE);
|
||||
+ else {
|
||||
+ free(*wwid);
|
||||
+ *wwid = NULL;
|
||||
+ }
|
||||
+ }
|
||||
+out:
|
||||
+ free_path(pp);
|
||||
+ return r;
|
||||
+}
|
||||
diff --git a/libmpathvalid/mpath_valid.h b/libmpathvalid/mpath_valid.h
|
||||
new file mode 100644
|
||||
index 00000000..7fd8aa47
|
||||
--- /dev/null
|
||||
+++ b/libmpathvalid/mpath_valid.h
|
||||
@@ -0,0 +1,57 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2015 Red Hat, Inc.
|
||||
+ *
|
||||
+ * This file is part of the device-mapper multipath userspace tools.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU Lesser General Public License
|
||||
+ * as published by the Free Software Foundation; either version 2
|
||||
+ * of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU Lesser General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU Lesser General Public License
|
||||
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
+ */
|
||||
+
|
||||
+#ifndef LIB_MPATH_VALID_H
|
||||
+#define LIB_MPATH_VALID_H
|
||||
+
|
||||
+#ifdef __cpluscplus
|
||||
+extern "C" {
|
||||
+#endif
|
||||
+
|
||||
+enum mpath_valid_mode {
|
||||
+ MPATH_DEFAULT,
|
||||
+ MPATH_STRICT,
|
||||
+ MPATH_SMART,
|
||||
+ MPATH_GREEDY,
|
||||
+ MPATH_MAX_MODE, /* used only for bounds checking */
|
||||
+};
|
||||
+
|
||||
+/* MPATH_IS_VALID_NO_CHECK is used to skip checks to see if the device
|
||||
+ * has already been unclaimed by multipath in the past */
|
||||
+enum mpath_valid_result {
|
||||
+ MPATH_IS_ERROR = -1,
|
||||
+ MPATH_IS_NOT_VALID,
|
||||
+ MPATH_IS_VALID,
|
||||
+ MPATH_IS_VALID_NO_CHECK,
|
||||
+ MPATH_IS_MAYBE_VALID,
|
||||
+};
|
||||
+
|
||||
+struct config;
|
||||
+extern struct config *mpathvalid_conf;
|
||||
+int mpathvalid_init(int verbosity);
|
||||
+int mpathvalid_exit(void);
|
||||
+unsigned int mpathvalid_get_mode(void);
|
||||
+int mpathvalid_is_path(const char *name, unsigned int mode, char **wwid,
|
||||
+ const char **path_wwids, unsigned int nr_paths);
|
||||
+
|
||||
+
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+#endif /* LIB_PATH_VALID_H */
|
||||
--
|
||||
2.17.2
|
||||
|
89
0071-libmultipath-add-uid-failback-for-dasd-devices.patch
Normal file
89
0071-libmultipath-add-uid-failback-for-dasd-devices.patch
Normal file
@ -0,0 +1,89 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Tue, 19 May 2020 15:55:15 -0500
|
||||
Subject: [PATCH] libmultipath: add uid failback for dasd devices
|
||||
|
||||
Add failback code to get the uid for dasd devices from sysfs. Copied
|
||||
from dasdinfo
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/defaults.h | 1 +
|
||||
libmultipath/discovery.c | 37 ++++++++++++++++++++++++++++++++++++-
|
||||
2 files changed, 37 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libmultipath/defaults.h b/libmultipath/defaults.h
|
||||
index 984d8dd8..6a678a83 100644
|
||||
--- a/libmultipath/defaults.h
|
||||
+++ b/libmultipath/defaults.h
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#define DEFAULT_UID_ATTRIBUTE "ID_SERIAL"
|
||||
#define DEFAULT_NVME_UID_ATTRIBUTE "ID_WWN"
|
||||
+#define DEFAULT_DASD_UID_ATTRIBUTE "ID_UID"
|
||||
#define DEFAULT_UDEVDIR "/dev"
|
||||
#define DEFAULT_MULTIPATHDIR "/" LIB_STRING "/multipath"
|
||||
#define DEFAULT_SELECTOR "service-time 0"
|
||||
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
||||
index aa5942c3..002d3d18 100644
|
||||
--- a/libmultipath/discovery.c
|
||||
+++ b/libmultipath/discovery.c
|
||||
@@ -1920,12 +1920,44 @@ get_vpd_uid(struct path * pp)
|
||||
return get_vpd_sysfs(parent, 0x83, pp->wwid, WWID_SIZE);
|
||||
}
|
||||
|
||||
+/* based on code from s390-tools/dasdinfo/dasdinfo.c */
|
||||
+static ssize_t dasd_get_uid(struct path *pp)
|
||||
+{
|
||||
+ struct udev_device *parent;
|
||||
+ char value[80];
|
||||
+ char *p;
|
||||
+ int i;
|
||||
+
|
||||
+ parent = udev_device_get_parent_with_subsystem_devtype(pp->udev, "ccw",
|
||||
+ NULL);
|
||||
+ if (!parent)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (sysfs_attr_get_value(parent, "uid", value, 80) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ p = value - 1;
|
||||
+ /* look for the 4th '.' and cut there */
|
||||
+ for (i = 0; i < 4; i++) {
|
||||
+ p = index(p + 1, '.');
|
||||
+ if (!p)
|
||||
+ break;
|
||||
+ }
|
||||
+ if (p)
|
||||
+ *p = '\0';
|
||||
+
|
||||
+ return strlcpy(pp->wwid, value, WWID_SIZE);
|
||||
+}
|
||||
+
|
||||
static ssize_t uid_fallback(struct path *pp, int path_state,
|
||||
const char **origin)
|
||||
{
|
||||
ssize_t len = -1;
|
||||
|
||||
- if (pp->bus == SYSFS_BUS_SCSI) {
|
||||
+ if (pp->bus == SYSFS_BUS_CCW) {
|
||||
+ len = dasd_get_uid(pp);
|
||||
+ *origin = "sysfs";
|
||||
+ } else if (pp->bus == SYSFS_BUS_SCSI) {
|
||||
len = get_vpd_uid(pp);
|
||||
*origin = "sysfs";
|
||||
if (len < 0 && path_state == PATH_UP) {
|
||||
@@ -1970,6 +2002,9 @@ static bool has_uid_fallback(struct path *pp)
|
||||
!strcmp(pp->uid_attribute, ""))) ||
|
||||
(pp->bus == SYSFS_BUS_NVME &&
|
||||
(!strcmp(pp->uid_attribute, DEFAULT_NVME_UID_ATTRIBUTE) ||
|
||||
+ !strcmp(pp->uid_attribute, ""))) ||
|
||||
+ (pp->bus == SYSFS_BUS_CCW &&
|
||||
+ (!strcmp(pp->uid_attribute, DEFAULT_DASD_UID_ATTRIBUTE) ||
|
||||
!strcmp(pp->uid_attribute, ""))));
|
||||
}
|
||||
|
||||
--
|
||||
2.17.2
|
||||
|
192
0072-libmultipath-add-ignore_udev_uid-option.patch
Normal file
192
0072-libmultipath-add-ignore_udev_uid-option.patch
Normal file
@ -0,0 +1,192 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Date: Wed, 20 May 2020 16:46:55 -0500
|
||||
Subject: [PATCH] libmultipath: add ignore_udev_uid option
|
||||
|
||||
Setting this option to yes will force multipath to get the uid by using
|
||||
the fallback sysfs methods, instead of getting it from udev. This will
|
||||
cause devices that can't get their uid from the standard locations to
|
||||
not get a uid. It will also disable uevent merging.
|
||||
|
||||
It will not stop uevents from being resent for device that failed to
|
||||
get a WWID, although I'm on the fence about the benefit of this.
|
||||
|
||||
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
||||
---
|
||||
libmultipath/config.h | 1 +
|
||||
libmultipath/dict.c | 4 ++++
|
||||
libmultipath/discovery.c | 17 +++++++++++------
|
||||
libmultipath/discovery.h | 8 +++++++-
|
||||
libmultipath/uevent.c | 2 +-
|
||||
multipath/multipath.conf.5 | 13 +++++++++++++
|
||||
multipathd/main.c | 7 ++++++-
|
||||
7 files changed, 43 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/libmultipath/config.h b/libmultipath/config.h
|
||||
index 160867cd..c7a73fba 100644
|
||||
--- a/libmultipath/config.h
|
||||
+++ b/libmultipath/config.h
|
||||
@@ -192,6 +192,7 @@ struct config {
|
||||
int find_multipaths_timeout;
|
||||
int marginal_pathgroups;
|
||||
int skip_delegate;
|
||||
+ int ignore_udev_uid;
|
||||
unsigned int version[3];
|
||||
unsigned int sequence_nr;
|
||||
|
||||
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
|
||||
index 184d4b22..9a0729bf 100644
|
||||
--- a/libmultipath/dict.c
|
||||
+++ b/libmultipath/dict.c
|
||||
@@ -1406,6 +1406,9 @@ declare_hw_snprint(all_tg_pt, print_yes_no_undef)
|
||||
declare_def_handler(marginal_pathgroups, set_yes_no)
|
||||
declare_def_snprint(marginal_pathgroups, print_yes_no)
|
||||
|
||||
+declare_def_handler(ignore_udev_uid, set_yes_no)
|
||||
+declare_def_snprint(ignore_udev_uid, print_yes_no)
|
||||
+
|
||||
static int
|
||||
def_uxsock_timeout_handler(struct config *conf, vector strvec)
|
||||
{
|
||||
@@ -1816,6 +1819,7 @@ init_keywords(vector keywords)
|
||||
install_keyword("enable_foreign", &def_enable_foreign_handler,
|
||||
&snprint_def_enable_foreign);
|
||||
install_keyword("marginal_pathgroups", &def_marginal_pathgroups_handler, &snprint_def_marginal_pathgroups);
|
||||
+ install_keyword("ignore_udev_uid", &def_ignore_udev_uid_handler, &snprint_def_ignore_udev_uid);
|
||||
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
|
||||
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
|
||||
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
|
||||
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
|
||||
index 002d3d18..f0e92227 100644
|
||||
--- a/libmultipath/discovery.c
|
||||
+++ b/libmultipath/discovery.c
|
||||
@@ -2010,7 +2010,7 @@ static bool has_uid_fallback(struct path *pp)
|
||||
|
||||
int
|
||||
get_uid (struct path * pp, int path_state, struct udev_device *udev,
|
||||
- int allow_fallback)
|
||||
+ int fallback)
|
||||
{
|
||||
char *c;
|
||||
const char *origin = "unknown";
|
||||
@@ -2043,7 +2043,9 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev,
|
||||
} else
|
||||
len = strlen(pp->wwid);
|
||||
origin = "callout";
|
||||
- } else {
|
||||
+ } else if (fallback == UID_FALLBACK_FORCE)
|
||||
+ len = uid_fallback(pp, path_state, &origin);
|
||||
+ else {
|
||||
bool udev_available = udev && pp->uid_attribute
|
||||
&& *pp->uid_attribute;
|
||||
|
||||
@@ -2056,8 +2058,9 @@ get_uid (struct path * pp, int path_state, struct udev_device *udev,
|
||||
else
|
||||
origin = "udev";
|
||||
}
|
||||
- if ((!udev_available || (len <= 0 && allow_fallback))
|
||||
- && has_uid_fallback(pp)) {
|
||||
+ if ((!udev_available ||
|
||||
+ (len <= 0 && fallback == UID_FALLBACK_ALLOW)) &&
|
||||
+ has_uid_fallback(pp)) {
|
||||
used_fallback = 1;
|
||||
len = uid_fallback(pp, path_state, &origin);
|
||||
}
|
||||
@@ -2197,8 +2200,10 @@ int pathinfo(struct path *pp, struct config *conf, int mask)
|
||||
}
|
||||
|
||||
if ((mask & DI_WWID) && !strlen(pp->wwid)) {
|
||||
- get_uid(pp, path_state, pp->udev,
|
||||
- (pp->retriggers >= conf->retrigger_tries));
|
||||
+ int fallback = conf->ignore_udev_uid? UID_FALLBACK_FORCE :
|
||||
+ (pp->retriggers >= conf->retrigger_tries)?
|
||||
+ UID_FALLBACK_ALLOW : UID_FALLBACK_NONE;
|
||||
+ get_uid(pp, path_state, pp->udev, fallback);
|
||||
if (!strlen(pp->wwid)) {
|
||||
if (pp->bus == SYSFS_BUS_UNDEF)
|
||||
return PATHINFO_SKIPPED;
|
||||
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
|
||||
index 6444887d..ca8542d6 100644
|
||||
--- a/libmultipath/discovery.h
|
||||
+++ b/libmultipath/discovery.h
|
||||
@@ -54,8 +54,14 @@ ssize_t sysfs_get_inquiry(struct udev_device *udev,
|
||||
unsigned char *buff, size_t len);
|
||||
int sysfs_get_asymmetric_access_state(struct path *pp,
|
||||
char *buff, int buflen);
|
||||
+
|
||||
+enum {
|
||||
+ UID_FALLBACK_NONE,
|
||||
+ UID_FALLBACK_ALLOW,
|
||||
+ UID_FALLBACK_FORCE,
|
||||
+};
|
||||
int get_uid(struct path * pp, int path_state, struct udev_device *udev,
|
||||
- int allow_fallback);
|
||||
+ int fallback);
|
||||
|
||||
/*
|
||||
* discovery bitmask
|
||||
diff --git a/libmultipath/uevent.c b/libmultipath/uevent.c
|
||||
index e0d13b11..d67129d1 100644
|
||||
--- a/libmultipath/uevent.c
|
||||
+++ b/libmultipath/uevent.c
|
||||
@@ -179,7 +179,7 @@ uevent_need_merge(void)
|
||||
bool need_merge = false;
|
||||
|
||||
conf = get_multipath_config();
|
||||
- if (VECTOR_SIZE(&conf->uid_attrs) > 0)
|
||||
+ if (!conf->ignore_udev_uid && VECTOR_SIZE(&conf->uid_attrs) > 0)
|
||||
need_merge = true;
|
||||
put_multipath_config(conf);
|
||||
|
||||
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
|
||||
index 42a192f6..175ca095 100644
|
||||
--- a/multipath/multipath.conf.5
|
||||
+++ b/multipath/multipath.conf.5
|
||||
@@ -286,6 +286,19 @@ The default is: \fB<unset>\fR
|
||||
.
|
||||
.
|
||||
.TP
|
||||
+.B ignore_udev_uid
|
||||
+Setting this option to yes will force multipath to ignore the the uid_attrs
|
||||
+and uid_attribute settings, and generate the WWID by the \fIsysfs\fR
|
||||
+method. This will cause devices that cannot get their WWID from the standard
|
||||
+locations for their device type to not get a WWID; see \fBWWID generation\fR
|
||||
+below.
|
||||
+.RS
|
||||
+.TP
|
||||
+The default is: \fBno\fR
|
||||
+.RE
|
||||
+.
|
||||
+.
|
||||
+.TP
|
||||
.B prio
|
||||
The name of the path priority routine. The specified routine
|
||||
should return a numeric value specifying the relative priority
|
||||
diff --git a/multipathd/main.c b/multipathd/main.c
|
||||
index f014d2a1..48b62937 100644
|
||||
--- a/multipathd/main.c
|
||||
+++ b/multipathd/main.c
|
||||
@@ -1226,6 +1226,7 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
|
||||
if (pp) {
|
||||
struct multipath *mpp = pp->mpp;
|
||||
char wwid[WWID_SIZE];
|
||||
+ int fallback;
|
||||
|
||||
if (pp->initialized == INIT_REQUESTED_UDEV) {
|
||||
needs_reinit = 1;
|
||||
@@ -1237,7 +1238,11 @@ uev_update_path (struct uevent *uev, struct vectors * vecs)
|
||||
goto out;
|
||||
|
||||
strcpy(wwid, pp->wwid);
|
||||
- rc = get_uid(pp, pp->state, uev->udev, 0);
|
||||
+ conf = get_multipath_config();
|
||||
+ fallback = conf->ignore_udev_uid? UID_FALLBACK_FORCE:
|
||||
+ UID_FALLBACK_NONE;
|
||||
+ put_multipath_config(conf);
|
||||
+ rc = get_uid(pp, pp->state, uev->udev, fallback);
|
||||
|
||||
if (rc != 0)
|
||||
strcpy(pp->wwid, wwid);
|
||||
--
|
||||
2.17.2
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: device-mapper-multipath
|
||||
Version: 0.8.4
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Tools to manage multipath devices using device-mapper
|
||||
License: GPLv2
|
||||
URL: http://christophe.varoqui.free.fr/
|
||||
@ -57,19 +57,31 @@ Patch0044: 0044-multipathd-add-del-maps-multipathd-command.patch
|
||||
Patch0045: 0045-multipath-make-flushing-maps-work-like-other-command.patch
|
||||
Patch0046: 0046-multipath-delegate-flushing-maps-to-multipathd.patch
|
||||
Patch0047: 0047-multipath-add-option-to-skip-multipathd-delegation.patch
|
||||
Patch0048: 0048-Makefile.inc-trim-extra-information-from-systemd-ver.patch
|
||||
Patch0049: 0049-kpartx-fix-Wsign-compare-error.patch
|
||||
Patch0050: 0050-RH-fixup-udev-rules-for-redhat.patch
|
||||
Patch0051: 0051-RH-Remove-the-property-blacklist-exception-builtin.patch
|
||||
Patch0052: 0052-RH-don-t-start-without-a-config-file.patch
|
||||
Patch0053: 0053-RH-use-rpm-optflags-if-present.patch
|
||||
Patch0054: 0054-RH-add-mpathconf.patch
|
||||
Patch0055: 0055-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
|
||||
Patch0056: 0056-RH-warn-on-invalid-regex-instead-of-failing.patch
|
||||
Patch0057: 0057-RH-reset-default-find_mutipaths-value-to-off.patch
|
||||
Patch0058: 0058-RH-Fix-nvme-compilation-warning.patch
|
||||
Patch0059: 0059-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
|
||||
Patch0060: 0060-RH-work-around-gcc-10-format-truncation-issue.patch
|
||||
Patch0048: 0048-libmultipath-add-device-to-hwtable.c.patch
|
||||
Patch0049: 0049-master-libmultipath-fix-use-after-free-when-iscsi-lo.patch
|
||||
Patch0050: 0050-libmultipath-warn-if-freeing-path-that-holds-mpp-hwe.patch
|
||||
Patch0051: 0051-libmultipath-warn-about-NULL-value-of-mpp-hwe.patch
|
||||
Patch0052: 0052-libmultipath-fix-mpp-hwe-handling-in-sync_paths.patch
|
||||
Patch0053: 0053-Makefile.inc-trim-extra-information-from-systemd-ver.patch
|
||||
Patch0054: 0054-kpartx-fix-Wsign-compare-error.patch
|
||||
Patch0055: 0055-libmultipath-remove-code-duplication-in-path-countin.patch
|
||||
Patch0056: 0056-libmultipath-count-pending-paths-as-active-on-loads.patch
|
||||
Patch0057: 0057-libmultipath-deal-with-flushing-no-maps.patch
|
||||
Patch0058: 0058-multipath-deal-with-delegation-failures-correctly.patch
|
||||
Patch0059: 0059-RH-fixup-udev-rules-for-redhat.patch
|
||||
Patch0060: 0060-RH-Remove-the-property-blacklist-exception-builtin.patch
|
||||
Patch0061: 0061-RH-don-t-start-without-a-config-file.patch
|
||||
Patch0062: 0062-RH-use-rpm-optflags-if-present.patch
|
||||
Patch0063: 0063-RH-add-mpathconf.patch
|
||||
Patch0064: 0064-RH-add-wwids-from-kernel-cmdline-mpath.wwids-with-A.patch
|
||||
Patch0065: 0065-RH-warn-on-invalid-regex-instead-of-failing.patch
|
||||
Patch0066: 0066-RH-reset-default-find_mutipaths-value-to-off.patch
|
||||
Patch0067: 0067-RH-Fix-nvme-compilation-warning.patch
|
||||
Patch0068: 0068-RH-attempt-to-get-ANA-info-via-sysfs-first.patch
|
||||
Patch0069: 0069-RH-work-around-gcc-10-format-truncation-issue.patch
|
||||
Patch0070: 0070-multipath-add-libmpathvalid-library.patch
|
||||
Patch0071: 0071-libmultipath-add-uid-failback-for-dasd-devices.patch
|
||||
Patch0072: 0072-libmultipath-add-ignore_udev_uid-option.patch
|
||||
|
||||
# runtime
|
||||
Requires: %{name}-libs = %{version}-%{release}
|
||||
@ -222,6 +234,7 @@ fi
|
||||
%{_libdir}/libmultipath.so.*
|
||||
%{_libdir}/libmpathpersist.so.*
|
||||
%{_libdir}/libmpathcmd.so.*
|
||||
%{_libdir}/libmpathvalid.so.*
|
||||
%dir %{_libmpathdir}
|
||||
%{_libmpathdir}/*
|
||||
|
||||
@ -231,8 +244,10 @@ fi
|
||||
%doc README
|
||||
%{_libdir}/libmpathpersist.so
|
||||
%{_libdir}/libmpathcmd.so
|
||||
%{_libdir}/libmpathvalid.so
|
||||
%{_includedir}/mpath_cmd.h
|
||||
%{_includedir}/mpath_persist.h
|
||||
%{_includedir}/mpath_valid.h
|
||||
%{_mandir}/man3/mpath_persistent_reserve_in.3.gz
|
||||
%{_mandir}/man3/mpath_persistent_reserve_out.3.gz
|
||||
|
||||
@ -263,6 +278,24 @@ fi
|
||||
%{_pkgconfdir}/libdmmp.pc
|
||||
|
||||
%changelog
|
||||
* Tue Jul 21 2020 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.4-4
|
||||
- Rebased on top of additional commits staged for upstream
|
||||
* Previous patches 0048-0060 are now patches 0053-0054 & 0059-0069
|
||||
- Add 0048-libmultipath-add-device-to-hwtable.c.patch
|
||||
- Add 0049-master-libmultipath-fix-use-after-free-when-iscsi-lo.patch
|
||||
- Add 0050-libmultipath-warn-if-freeing-path-that-holds-mpp-hwe.patch
|
||||
- Add 0051-libmultipath-warn-about-NULL-value-of-mpp-hwe.patch
|
||||
- Add 0052-libmultipath-fix-mpp-hwe-handling-in-sync_paths.patch
|
||||
- Add 0055-libmultipath-remove-code-duplication-in-path-countin.patch
|
||||
- Add 0056-libmultipath-count-pending-paths-as-active-on-loads.patch
|
||||
- Add 0057-libmultipath-deal-with-flushing-no-maps.patch
|
||||
- Add 0058-multipath-deal-with-delegation-failures-correctly.patch
|
||||
- Add 0070-multipath-add-libmpathvalid-library.patch
|
||||
* adds the libmpathvalid.so library to determine if devices are
|
||||
valid multipath paths.
|
||||
- Add 0071-libmultipath-add-uid-failback-for-dasd-devices.patch
|
||||
- Add 0072-libmultipath-add-ignore_udev_uid-option.patch
|
||||
|
||||
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 0.8.4-3
|
||||
- Use make macros
|
||||
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
|
||||
|
Loading…
Reference in New Issue
Block a user