From a7a17c3ed5c63e4a9262e12d28f49059ca8d093d Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jul 28 2020 19:03:25 +0000 Subject: import device-mapper-multipath-0.8.4-5.el8 --- diff --git a/SOURCES/0037-libmultipath-count-pending-paths-as-active-on-loads.patch b/SOURCES/0037-libmultipath-count-pending-paths-as-active-on-loads.patch new file mode 100644 index 0000000..d4ff3c2 --- /dev/null +++ b/SOURCES/0037-libmultipath-count-pending-paths-as-active-on-loads.patch @@ -0,0 +1,86 @@ +From 7159242be31dbb3f25aa67920462107bc2bc5fe0 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Thu, 9 Jul 2020 18:20:18 -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 +--- + libmultipath/devmapper.c | 3 ++- + libmultipath/structs.c | 20 ++++++++++++++++++++ + libmultipath/structs.h | 1 + + 3 files changed, 23 insertions(+), 1 deletion(-) + +diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c +index 7f98bf9d..91ff0b3d 100644 +--- a/libmultipath/devmapper.c ++++ b/libmultipath/devmapper.c +@@ -408,7 +408,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 2dd378c4..dda9884c 100644 +--- a/libmultipath/structs.c ++++ b/libmultipath/structs.c +@@ -500,6 +500,26 @@ int count_active_paths(const struct multipath *mpp) + return count; + } + ++int count_active_pending_paths(const struct multipath *mpp) ++{ ++ struct pathgroup *pgp; ++ struct path *pp; ++ int count = 0; ++ int i, j; ++ ++ if (!mpp->pg) ++ return 0; ++ ++ vector_foreach_slot (mpp->pg, pgp, i) { ++ vector_foreach_slot (pgp->paths, pp, j) { ++ if (pp->state == PATH_UP || pp->state == PATH_GHOST || ++ pp->state == PATH_PENDING) ++ count++; ++ } ++ } ++ return count; ++} ++ + int pathcmp(const struct pathgroup *pgp, const struct pathgroup *cpgp) + { + int i, j; +diff --git a/libmultipath/structs.h b/libmultipath/structs.h +index 9bd39eb1..8e78b8c0 100644 +--- a/libmultipath/structs.h ++++ b/libmultipath/structs.h +@@ -465,6 +465,7 @@ 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 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 + diff --git a/SOURCES/0038-multipath-deal-with-failures-flushing-maps.patch b/SOURCES/0038-multipath-deal-with-failures-flushing-maps.patch new file mode 100644 index 0000000..a73e25f --- /dev/null +++ b/SOURCES/0038-multipath-deal-with-failures-flushing-maps.patch @@ -0,0 +1,58 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Mon, 13 Jul 2020 15:41:15 -0500 +Subject: [PATCH] multipath: deal with failures flushing 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. + +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. + +Signed-off-by: Benjamin Marzinski +--- + libmultipath/devmapper.c | 2 +- + multipath/main.c | 9 ++++++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c +index 91ff0b3d..3f70e576 100644 +--- a/libmultipath/devmapper.c ++++ b/libmultipath/devmapper.c +@@ -970,10 +970,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); +diff --git a/multipath/main.c b/multipath/main.c +index 3c3d2398..607cada2 100644 +--- a/multipath/main.c ++++ b/multipath/main.c +@@ -869,9 +869,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 + diff --git a/SPECS/device-mapper-multipath.spec b/SPECS/device-mapper-multipath.spec index a2c64cf..e479429 100644 --- a/SPECS/device-mapper-multipath.spec +++ b/SPECS/device-mapper-multipath.spec @@ -1,7 +1,7 @@ Summary: Tools to manage multipath devices using device-mapper Name: device-mapper-multipath Version: 0.8.4 -Release: 3%{?dist} +Release: 5%{?dist} License: GPLv2 Group: System Environment/Base URL: http://christophe.varoqui.free.fr/ @@ -47,6 +47,8 @@ Patch00033: 0033-kpartx-handle-alternate-bsd-disklabel-location.patch Patch00034: 0034-libmultipath-fix-checker-detection-for-nvme-devices.patch Patch00035: 0035-Makefile.inc-trim-extra-information-from-systemd-ver.patch Patch00036: 0036-kpartx-fix-Wsign-compare-error.patch +Patch00037: 0037-libmultipath-count-pending-paths-as-active-on-loads.patch +Patch00038: 0038-multipath-deal-with-failures-flushing-maps.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -248,6 +250,22 @@ fi %{_pkgconfdir}/libdmmp.pc %changelog +* Mon Jul 13 2020 Benjamin Marzinski 0.8.4-5 +- Add 0038-multipath-deal-with-failures-flushing-maps.patch + * Don't print "fail" if multipath needs to failback to removing + a device itself. + * Fixes bz #1845875 +- Modify multipath_conf_syntax CI test + * It started failing because "multpath -F" can now start multipathd + via the socket, and the test expected multipathd to not be running +- Resolves: bz #1845875 + +* Fri Jul 10 2020 Benjamin Marzinski 0.8.4-4 +- Add 0037-libmultipath-count-pending-paths-as-active-on-loads.patch + * make udev treat the device as having paths, so it will run kpartx + * Fixes bz #1846866 +- Resolves: bz #1846866 + * Mon Jul 6 2020 Benjamin Marzinski 0.8.4-3 - Add 0024-libmultipath-make-dm_get_map-status-return-codes-sym.patch - Add 0025-multipathd-fix-check_path-errors-with-removed-map.patch