File bsc#1181744-0001-Fix-fence-history-fail-leftover-pending-actions-afte.patch of Package pacemaker.27558
From 14bb468ab404228cae34809420ef0763d3d54482 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Thu, 13 Jun 2019 15:31:24 +0200
Subject: [PATCH 1/7] Fix: fence-history: fail leftover pending-actions after
fenced-restart
---
daemons/fenced/fenced_history.c | 15 +++++++++++++++
daemons/fenced/fenced_remote.c | 6 +++---
daemons/fenced/pacemaker-fenced.h | 8 ++++++++
3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/daemons/fenced/fenced_history.c b/daemons/fenced/fenced_history.c
index 7c129cca3..b65b64c7f 100644
--- a/daemons/fenced/fenced_history.c
+++ b/daemons/fenced/fenced_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/daemons/fenced/fenced_remote.c b/daemons/fenced/fenced_remote.c
index 7d612499e..5b86f0f78 100644
--- a/daemons/fenced/fenced_remote.c
+++ b/daemons/fenced/fenced_remote.c
@@ -369,8 +369,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);
@@ -509,7 +509,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;
}
diff --git a/daemons/fenced/pacemaker-fenced.h b/daemons/fenced/pacemaker-fenced.h
index 3a2edbbc4..a8531a69c 100644
--- a/daemons/fenced/pacemaker-fenced.h
+++ b/daemons/fenced/pacemaker-fenced.h
@@ -149,6 +149,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,
--
2.26.2