File bsc#1151007-0001-Fix-fencer-Don-t-let-a-fencing-command-with-a-long-d.patch of Package pacemaker.16889

From 6c7ca69d7407b84eb78f9e37f8038ec35a640ca9 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Fri, 11 Oct 2019 12:52:08 +0200
Subject: [PATCH 1/3] Fix: fencer: Don't let a fencing command with a long
 delay block any other commands pending on the device

---
 daemons/fenced/fenced_commands.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/daemons/fenced/fenced_commands.c b/daemons/fenced/fenced_commands.c
index f3ace2277..2064484e0 100644
--- a/daemons/fenced/fenced_commands.c
+++ b/daemons/fenced/fenced_commands.c
@@ -331,6 +331,8 @@ stonith_device_execute(stonith_device_t * device)
     stonith_action_t *action = NULL;
     int active_cmds = 0;
     int action_limit = 0;
+    GListPtr gIter = NULL;
+    GListPtr gIterNext = NULL;
 
     CRM_CHECK(device != NULL, return FALSE);
 
@@ -342,24 +344,29 @@ stonith_device_execute(stonith_device_t * device)
         return TRUE;
     }
 
-    if (device->pending_ops) {
-        GList *first = device->pending_ops;
+    for (gIter = device->pending_ops; gIter != NULL; gIter = gIterNext) {
+        async_command_t *pending_op = gIter->data;
 
-        cmd = first->data;
-        if (cmd && cmd->delay_id) {
+        gIterNext = gIter->next;
+
+        if (pending_op && pending_op->delay_id) {
             crm_trace
                 ("Operation %s%s%s on %s was asked to run too early, waiting for start_delay timeout of %dms",
-                 cmd->action, cmd->victim ? " for node " : "", cmd->victim ? cmd->victim : "",
-                 device->id, cmd->start_delay);
-            return TRUE;
+                 pending_op->action, pending_op->victim ? " for node " : "",
+                 pending_op->victim ? pending_op->victim : "",
+                 device->id, pending_op->start_delay);
+            continue;
         }
 
-        device->pending_ops = g_list_remove_link(device->pending_ops, first);
-        g_list_free_1(first);
+        device->pending_ops = g_list_remove_link(device->pending_ops, gIter);
+        g_list_free_1(gIter);
+
+        cmd = pending_op;
+        break;
     }
 
     if (cmd == NULL) {
-        crm_trace("Nothing further to do for %s", device->id);
+        crm_trace("Nothing further to do for %s for now", device->id);
         return TRUE;
     }
 
-- 
2.16.4

openSUSE Build Service is sponsored by