File bsc#1181744-0001-Fix-fence-history-fail-leftover-pending-actions-afte-1.1.patch of Package pacemaker.22685
From 71142273e6b5108224ecdb0082b36f533b604fad Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Mon, 8 Jul 2019 18:17:28 +0200
Subject: [PATCH 1/8] Fix: fence-history: fail leftover pending-actions after
stonithd-restart
---
fencing/history.c | 15 +++++++++++++++
fencing/internal.h | 8 ++++++++
fencing/remote.c | 6 +++---
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/fencing/history.c b/fencing/history.c
index 0f9805868..c48784886 100644
--- a/fencing/history.c
+++ b/fencing/history.c
@@ -347,6 +347,21 @@ stonith_merge_in_history_list(GHashTable *history)
updated = TRUE;
g_hash_table_iter_steal(&iter);
+
+ if ((op->state != st_failed) &&
+ (op->state != st_done) &&
+ safe_str_eq(op->originator, stonith_our_uname)) {
+ crm_warn("received pending action we are supposed to be the "
+ "owner but it's not in our records -> fail it");
+ op->state = st_failed;
+ op->completed = time(NULL);
+ /* use -EHOSTUNREACH to not introduce a new return-code that might
+ trigger unexpected results at other places and to prevent
+ remote_op_done from setting the delegate if not present
+ */
+ stonith_bcast_result_to_peers(op, -EHOSTUNREACH);
+ }
+
g_hash_table_insert(stonith_remote_op_list, op->id, op);
/* we could trim the history here but if we bail
* out after trim we might miss more recent entries
diff --git a/fencing/internal.h b/fencing/internal.h
index 028137f92..cd48b53a1 100644
--- a/fencing/internal.h
+++ b/fencing/internal.h
@@ -142,6 +142,14 @@ typedef struct remote_fencing_op_s {
} remote_fencing_op_t;
+/*!
+ * \internal
+ * \brief Broadcast the result of an operation to the peers.
+ * \param op, Operation whose result should be broadcast
+ * \param rc, Result of the operation
+ */
+void stonith_bcast_result_to_peers(remote_fencing_op_t * op, int rc);
+
enum st_callback_flags {
st_callback_unknown = 0x0000,
st_callback_notify_fence = 0x0001,
diff --git a/fencing/remote.c b/fencing/remote.c
index 866112ff6..6c5b9b812 100644
--- a/fencing/remote.c
+++ b/fencing/remote.c
@@ -379,8 +379,8 @@ create_op_done_notify(remote_fencing_op_t * op, int rc)
return notify_data;
}
-static void
-bcast_result_to_peers(remote_fencing_op_t * op, int rc)
+void
+stonith_bcast_result_to_peers(remote_fencing_op_t * op, int rc)
{
static int count = 0;
xmlNode *bcast = create_xml_node(NULL, T_STONITH_REPLY);
@@ -518,7 +518,7 @@ remote_op_done(remote_fencing_op_t * op, xmlNode * data, int rc, int dup)
subt = crm_element_value(data, F_SUBTYPE);
if (dup == FALSE && safe_str_neq(subt, "broadcast")) {
/* Defer notification until the bcast message arrives */
- bcast_result_to_peers(op, rc);
+ stonith_bcast_result_to_peers(op, rc);
goto remote_op_done_cleanup;
}
--
2.26.2