9abdc502cf
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
74 lines
2.9 KiB
Diff
74 lines
2.9 KiB
Diff
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
|
|
|