diff --git a/SOURCES/0013-Fix-sbd-pacemaker-assume-graceful-exit-if-leftovers-.patch b/SOURCES/0013-Fix-sbd-pacemaker-assume-graceful-exit-if-leftovers-.patch new file mode 100644 index 0000000..8c92df8 --- /dev/null +++ b/SOURCES/0013-Fix-sbd-pacemaker-assume-graceful-exit-if-leftovers-.patch @@ -0,0 +1,60 @@ +From 824fe834c67fb7bae7feb87607381f9fa8fa2945 Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Fri, 7 Jun 2019 19:09:06 +0200 +Subject: [PATCH] Fix: sbd-pacemaker: assume graceful exit if leftovers are + unmanged + +--- + src/sbd-pacemaker.c | 32 +++++++++++++++++++++++++++++++- + 1 file changed, 31 insertions(+), 1 deletion(-) + +diff --git a/src/sbd-pacemaker.c b/src/sbd-pacemaker.c +index 9a8b95f..2b35ff6 100644 +--- a/src/sbd-pacemaker.c ++++ b/src/sbd-pacemaker.c +@@ -333,11 +333,41 @@ compute_status(pe_working_set_t * data_set) + } + } + ++ /* If we are in shutdown-state once this will go on till the end. ++ * If we've on top reached a state of 0 locally running resources ++ * we can assume a clean shutdown. ++ * Tricky are the situations where the node is in maintenance-mode ++ * or resources are unmanaged. So if the node is in maintenance or ++ * all left-over running resources are unmanaged we assume intention. ++ */ + if (node->details->shutdown) { + pcmk_shutdown = 1; + } +- if (pcmk_shutdown && !(node->details->running_rsc)) { ++ if (pcmk_shutdown) ++ { + pcmk_clean_shutdown = 1; ++ if (!(node->details->maintenance)) { ++ GListPtr iter; ++ ++ for (iter = node->details->running_rsc; ++ iter != NULL; iter = iter->next) { ++ resource_t *rsc = (resource_t *) iter->data; ++ ++ ++ if (is_set(rsc->flags, pe_rsc_managed)) { ++ pcmk_clean_shutdown = 0; ++ crm_debug("not clean as %s managed and still running", ++ rsc->id); ++ break; ++ } ++ } ++ if (pcmk_clean_shutdown) { ++ crm_debug("pcmk_clean_shutdown because " ++ "all managed resources down"); ++ } ++ } else { ++ crm_debug("pcmk_clean_shutdown because node is in maintenance"); ++ } + } + notify_parent(); + return; +-- +1.8.3.1 + diff --git a/SOURCES/0016-Fix-sbd-pacemaker-check-for-shutdown-attribute-on-ev.patch b/SOURCES/0016-Fix-sbd-pacemaker-check-for-shutdown-attribute-on-ev.patch new file mode 100644 index 0000000..16a50e0 --- /dev/null +++ b/SOURCES/0016-Fix-sbd-pacemaker-check-for-shutdown-attribute-on-ev.patch @@ -0,0 +1,54 @@ +From c8e3de2a7e98550ea9f27a0c59e13013ce02992d Mon Sep 17 00:00:00 2001 +From: Klaus Wenninger +Date: Fri, 16 Aug 2019 12:07:32 +0200 +Subject: [PATCH] Fix: sbd-pacemaker: check for shutdown attribute on every + cib-diff + +--- + src/sbd-pacemaker.c | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) + +diff --git a/src/sbd-pacemaker.c b/src/sbd-pacemaker.c +index 2b35ff6..1217acf 100644 +--- a/src/sbd-pacemaker.c ++++ b/src/sbd-pacemaker.c +@@ -383,6 +383,24 @@ mon_trigger_refresh(gpointer user_data) + return FALSE; + } + ++#define XPATH_SHUTDOWN "//" XML_CIB_TAG_STATE "[@uname='%s']/" \ ++ XML_TAG_TRANSIENT_NODEATTRS "/" XML_TAG_ATTR_SETS "/" \ ++ XML_CIB_TAG_NVPAIR "[@name='" XML_CIB_ATTR_SHUTDOWN "']" ++ ++static gboolean ++shutdown_attr_in_cib(void) ++{ ++ xmlNode *match = NULL; ++ char *xpath_string; ++ ++ xpath_string = crm_strdup_printf(XPATH_SHUTDOWN, local_uname); ++ if (xpath_string) { ++ match = get_xpath_object(xpath_string, current_cib, LOG_TRACE); ++ free(xpath_string); ++ } ++ return (match != NULL); ++} ++ + static void + crm_diff_update(const char *event, xmlNode * msg) + { +@@ -426,8 +444,10 @@ crm_diff_update(const char *event, xmlNode * msg) + * - immediately if the last update was more than 1s ago + * - every 10 updates + * - at most 1s after the last update ++ * - shutdown attribute for our node set for the first time + */ +- if (updates > 10 || (now - last_refresh) > (reconnect_msec / 1000)) { ++ if ((!pcmk_shutdown && shutdown_attr_in_cib()) || ++ (updates > 10 || (now - last_refresh) > (reconnect_msec / 1000))) { + mon_refresh_state(refresh_timer); + updates = 0; + +-- +1.8.3.1 + diff --git a/SPECS/sbd.spec b/SPECS/sbd.spec index aef0286..5e0654c 100644 --- a/SPECS/sbd.spec +++ b/SPECS/sbd.spec @@ -25,12 +25,14 @@ Summary: Storage-based death License: GPLv2+ Group: System Environment/Daemons Version: 1.4.0 -Release: %{buildnum}%{?dist} +Release: %{buildnum}%{?dist}.3 Url: https://github.com/%{github_owner}/%{name} Source0: https://github.com/%{github_owner}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz Patch0: 0001-Fix-sbd-cluster-finalize-cmap-connection-if-disconne.patch Patch1: 0002-Fix-sbd-pacemaker-make-handling-of-cib-connection-lo.patch Patch2: 0003-Fix-sbd-pacemaker-bail-out-of-status-earlier.patch +Patch12: 0013-Fix-sbd-pacemaker-assume-graceful-exit-if-leftovers-.patch +Patch15: 0016-Fix-sbd-pacemaker-check-for-shutdown-attribute-on-ev.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf BuildRequires: automake @@ -128,6 +130,21 @@ fi %doc COPYING %changelog +* Thu Aug 16 2019 Klaus Wenninger - 1.4.0-4.3 +- check for shutdown attribute on every cib-diff + + Resolves: rhbz#1732334 + +* Thu Aug 1 2019 Klaus Wenninger - 1.4.0-4.2 +- rebuild using correct target + + Resolves: rhbz#1732334 + +* Tue Jul 30 2019 Klaus Wenninger - 1.4.0-4.1 +- assume graceful pacemaker exit if leftovers are unmanaged + + Resolves: rhbz#1732334 + * Tue Mar 26 2019 Klaus Wenninger - 1.4.0-4 - fix possible null-pointer-access just introduced