From 2e716efd62fe309408808dd2360bbcb7845b8ea5 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Fri, 23 Sep 2022 16:13:00 +0000 Subject: [PATCH] import device-mapper-multipath-0.8.4-30.el8 --- ...r-out-the-code-to-flush-a-map-with-n.patch | 90 +++++++++++++++++++ ...urn-success-if-we-raced-to-remove-a-.patch | 47 ++++++++++ ...Handle-losing-all-path-in-update_map.patch | 36 ++++++++ SPECS/device-mapper-multipath.spec | 15 +++- 4 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 SOURCES/0111-multipathd-factor-out-the-code-to-flush-a-map-with-n.patch create mode 100644 SOURCES/0112-libmultipath-return-success-if-we-raced-to-remove-a-.patch create mode 100644 SOURCES/0113-multipathd-Handle-losing-all-path-in-update_map.patch diff --git a/SOURCES/0111-multipathd-factor-out-the-code-to-flush-a-map-with-n.patch b/SOURCES/0111-multipathd-factor-out-the-code-to-flush-a-map-with-n.patch new file mode 100644 index 0000000..27f4b98 --- /dev/null +++ b/SOURCES/0111-multipathd-factor-out-the-code-to-flush-a-map-with-n.patch @@ -0,0 +1,90 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Tue, 9 Aug 2022 16:46:26 -0500 +Subject: [PATCH] multipathd: factor out the code to flush a map with no paths + +The code to flush a multipath device because all of its paths have +been removed will be used by another caller, so factor it out of +ev_remove_path(). + +Signed-off-by: Benjamin Marzinski +Reviewed-by: Martin Wilck +--- + multipathd/main.c | 56 ++++++++++++++++++++++++----------------------- + 1 file changed, 29 insertions(+), 27 deletions(-) + +diff --git a/multipathd/main.c b/multipathd/main.c +index a6ffbe32..9b1098f6 100644 +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -487,6 +487,30 @@ int update_multipath (struct vectors *vecs, char *mapname, int reset) + return 0; + } + ++static bool ++flush_map_nopaths(struct multipath *mpp, struct vectors *vecs) { ++ char alias[WWID_SIZE]; ++ ++ /* ++ * flush_map will fail if the device is open ++ */ ++ strlcpy(alias, mpp->alias, WWID_SIZE); ++ if (mpp->flush_on_last_del == FLUSH_ENABLED) { ++ condlog(2, "%s Last path deleted, disabling queueing", ++ mpp->alias); ++ mpp->retry_tick = 0; ++ mpp->no_path_retry = NO_PATH_RETRY_FAIL; ++ mpp->disable_queueing = 1; ++ mpp->stat_map_failures++; ++ dm_queue_if_no_path(mpp->alias, 0); ++ } ++ if (!flush_map(mpp, vecs, 1)) { ++ condlog(2, "%s: removed map after removing all paths", alias); ++ return true; ++ } ++ return false; ++} ++ + static int + update_map (struct multipath *mpp, struct vectors *vecs, int new_map) + { +@@ -1185,34 +1209,12 @@ ev_remove_path (struct path *pp, struct vectors * vecs, int need_do_map) + vector_del_slot(mpp->paths, i); + + /* +- * remove the map IF removing the last path ++ * remove the map IF removing the last path. If ++ * flush_map_nopaths succeeds, the path has been removed. + */ +- if (VECTOR_SIZE(mpp->paths) == 0) { +- char alias[WWID_SIZE]; +- +- /* +- * flush_map will fail if the device is open +- */ +- strlcpy(alias, mpp->alias, WWID_SIZE); +- if (mpp->flush_on_last_del == FLUSH_ENABLED) { +- condlog(2, "%s Last path deleted, disabling queueing", mpp->alias); +- mpp->retry_tick = 0; +- mpp->no_path_retry = NO_PATH_RETRY_FAIL; +- mpp->disable_queueing = 1; +- mpp->stat_map_failures++; +- dm_queue_if_no_path(mpp->alias, 0); +- } +- if (!flush_map(mpp, vecs, 1)) { +- condlog(2, "%s: removed map after" +- " removing all paths", +- alias); +- retval = 0; +- goto out; +- } +- /* +- * Not an error, continue +- */ +- } ++ if (VECTOR_SIZE(mpp->paths) == 0 && ++ flush_map_nopaths(mpp, vecs)) ++ goto out; + + if (mpp->hwe == NULL) + extract_hwe_from_path(mpp); diff --git a/SOURCES/0112-libmultipath-return-success-if-we-raced-to-remove-a-.patch b/SOURCES/0112-libmultipath-return-success-if-we-raced-to-remove-a-.patch new file mode 100644 index 0000000..ce2a539 --- /dev/null +++ b/SOURCES/0112-libmultipath-return-success-if-we-raced-to-remove-a-.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Tue, 9 Aug 2022 16:46:27 -0500 +Subject: [PATCH] libmultipath: return success if we raced to remove a map and + lost + +_dm_flush_map() was returning failure if it failed to remove a map, +even if that was because the map had already been removed. Return +success in this case. + +Signed-off-by: Benjamin Marzinski +Reviewed-by: Martin Wilck +--- + libmultipath/devmapper.c | 4 ++++ + multipathd/main.c | 4 ---- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libmultipath/devmapper.c b/libmultipath/devmapper.c +index e3c3c119..ee81acc3 100644 +--- a/libmultipath/devmapper.c ++++ b/libmultipath/devmapper.c +@@ -916,6 +916,10 @@ int _dm_flush_map (const char * mapname, int need_sync, int deferred_remove, + } + condlog(4, "multipath map %s removed", mapname); + return 0; ++ } else if (dm_is_mpath(mapname) != 1) { ++ condlog(4, "multipath map %s removed externally", ++ mapname); ++ return 0; /*we raced with someone else removing it */ + } else { + condlog(2, "failed to remove multipath map %s", + mapname); +diff --git a/multipathd/main.c b/multipathd/main.c +index 9b1098f6..9eafd5b7 100644 +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -673,10 +673,6 @@ flush_map(struct multipath * mpp, struct vectors * vecs, int nopaths) + * the spurious uevent we may generate with the dm_flush_map call below + */ + if (r) { +- /* +- * May not really be an error -- if the map was already flushed +- * from the device mapper by dmsetup(8) for instance. +- */ + if (r == 1) + condlog(0, "%s: can't flush", mpp->alias); + else { diff --git a/SOURCES/0113-multipathd-Handle-losing-all-path-in-update_map.patch b/SOURCES/0113-multipathd-Handle-losing-all-path-in-update_map.patch new file mode 100644 index 0000000..28878dd --- /dev/null +++ b/SOURCES/0113-multipathd-Handle-losing-all-path-in-update_map.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Benjamin Marzinski +Date: Tue, 9 Aug 2022 16:46:28 -0500 +Subject: [PATCH] multipathd: Handle losing all path in update_map + +Its possible that when a multipath device is being updated, it will end +up that all the paths for it are gone. This can happen if paths are +added and then removed again before multipathd processes the uevent for +the newly created multipath device. In this case multipathd wasn't +taking the proper action for the case where all the paths had been +removed. If flush_on_last_del was set, multipathd wasn't disabling +flushing and if deferred_remove was set, it wasn't doing a deferred +remove. Multipathd should call flush_map_nopaths(), just like +ev_remove_path() does when the last path is removed. + +Signed-off-by: Benjamin Marzinski +Reviewed-by: Martin Wilck +--- + multipathd/main.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/multipathd/main.c b/multipathd/main.c +index 9eafd5b7..870ae7d8 100644 +--- a/multipathd/main.c ++++ b/multipathd/main.c +@@ -526,6 +526,10 @@ retry: + goto fail; + } + verify_paths(mpp, vecs); ++ if (VECTOR_SIZE(mpp->paths) == 0 && ++ flush_map_nopaths(mpp, vecs)) ++ return 1; ++ + mpp->action = ACT_RELOAD; + + if (setup_map(mpp, params, PARAMS_SIZE, vecs)) { diff --git a/SPECS/device-mapper-multipath.spec b/SPECS/device-mapper-multipath.spec index b76d258..e85600f 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: 28%{?dist} +Release: 30%{?dist} License: GPLv2 Group: System Environment/Base URL: http://christophe.varoqui.free.fr/ @@ -121,6 +121,9 @@ Patch00107: 0107-libmultipath-unset-detect_checker-for-clariion-Unity.patch Patch00108: 0108-multipathd-Add-missing-ctype-include.patch Patch00109: 0109-multipathd-replace-libreadline-with-libedit.patch Patch00110: 0110-multipath-fix-systemd-timers-in-the-initramfs.patch +Patch00111: 0111-multipathd-factor-out-the-code-to-flush-a-map-with-n.patch +Patch00112: 0112-libmultipath-return-success-if-we-raced-to-remove-a-.patch +Patch00113: 0113-multipathd-Handle-losing-all-path-in-update_map.patch # runtime Requires: %{name}-libs = %{version}-%{release} @@ -323,6 +326,16 @@ fi %{_pkgconfdir}/libdmmp.pc %changelog +* Fri Sep 9 2022 Benjamin Marzinski 0.8.4-30 +- Add 0111-multipathd-factor-out-the-code-to-flush-a-map-with-n.patch +- Add 0112-libmultipath-return-success-if-we-raced-to-remove-a-.patch +- Add 0113-multipathd-Handle-losing-all-path-in-update_map.patch +- Resolves: bz #2110485 + +* Fri Sep 2 2022 Benjamin Marzinski 0.8.4-29 +- Rebuild for rhel-8.8.0 +- Resolves: bz #2123446 + * Wed Aug 24 2022 Benjamin Marzinski 0.8.4-28 - Add 0110-multipath-fix-systemd-timers-in-the-initramfs.patch - Resolves: bz #1916168