File bsc#1151007-0002-Fix-fencer-Make-sure-concurrent-fencing-commands-get.patch of Package pacemaker.21299

From 2de20b62e5d13876b08e456c4ef31bdae05d6ca8 Mon Sep 17 00:00:00 2001
From: "Gao,Yan" <ygao@suse.com>
Date: Fri, 11 Oct 2019 14:08:11 +0200
Subject: [PATCH 2/3] Fix: fencer: Make sure concurrent fencing commands get
 triggered to execute

A fencing device might get triggered to work by multiple fencing
commands simultaneously. Trigger the device again to make sure any
remaining concurrent commands get executed.
---
 fencing/commands.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Index: pacemaker-2.0.1+20190417.13d370ca9/fencing/commands.c
===================================================================
--- pacemaker-2.0.1+20190417.13d370ca9.orig/fencing/commands.c
+++ pacemaker-2.0.1+20190417.13d370ca9/fencing/commands.c
@@ -352,16 +352,16 @@ stonith_device_execute(stonith_device_t
     if(safe_str_eq(device->agent, STONITH_WATCHDOG_AGENT)) {
         if(safe_str_eq(cmd->action, "reboot")) {
             pcmk_panic(__FUNCTION__);
-            return TRUE;
+            goto done;
 
         } else if(safe_str_eq(cmd->action, "off")) {
             pcmk_panic(__FUNCTION__);
-            return TRUE;
+            goto done;
 
         } else {
             crm_info("Faking success for %s watchdog operation", cmd->action);
             cmd->done_cb(0, 0, NULL, cmd);
-            return TRUE;
+            goto done;
         }
     }
 
@@ -377,7 +377,7 @@ stonith_device_execute(stonith_device_t
                     "considering resource not configured", device->id);
             exec_rc = PCMK_OCF_NOT_CONFIGURED;
             cmd->done_cb(0, exec_rc, NULL, cmd);
-            return TRUE;
+            goto done;
         }
     }
 #endif
@@ -409,6 +409,14 @@ stonith_device_execute(stonith_device_t
                  device->id, pcmk_strerror(exec_rc), exec_rc);
         cmd->done_cb(0, exec_rc, NULL, cmd);
     }
+
+done:
+    /* Device might get triggered to work by multiple fencing commands
+     * simultaneously. Trigger the device again to make sure any
+     * remaining concurrent commands get executed. */
+    if (device->pending_ops && g_list_length(device->pending_ops) > 0) {
+        mainloop_set_trigger(device->work);
+    }
     return TRUE;
 }
 
openSUSE Build Service is sponsored by