Blame SOURCES/0001-Fix-sbd-cluster-finalize-cmap-connection-if-disconne.patch

52408e
From f8f980340256ab5bef5385cd3bc082fdfb7613ed Mon Sep 17 00:00:00 2001
52408e
From: "Gao,Yan" <ygao@suse.com>
52408e
Date: Thu, 7 Mar 2019 15:01:26 +0100
52408e
Subject: [PATCH] Fix: sbd-cluster: finalize cmap connection if disconnected
52408e
 from cluster
52408e
52408e
Previously if sbd cluster servant anyhow got dis-/reconnected from the
52408e
cluster, it'd start hogging CPU keeping polling the main loop source
52408e
from the old cmap connection.
52408e
---
52408e
 src/sbd-cluster.c | 38 ++++++++++++++++++++++++++------------
52408e
 1 file changed, 26 insertions(+), 12 deletions(-)
52408e
52408e
diff --git a/src/sbd-cluster.c b/src/sbd-cluster.c
52408e
index 51bb456..541212f 100644
52408e
--- a/src/sbd-cluster.c
52408e
+++ b/src/sbd-cluster.c
52408e
@@ -174,6 +174,25 @@ cmap_dispatch_callback (gpointer user_data)
52408e
     return TRUE;
52408e
 }
52408e
 
52408e
+static void
52408e
+cmap_destroy(void)
52408e
+{
52408e
+    if (cmap_source) {
52408e
+        g_source_destroy(cmap_source);
52408e
+        cmap_source = NULL;
52408e
+    }
52408e
+
52408e
+    if (track_handle) {
52408e
+        cmap_track_delete(cmap_handle, track_handle);
52408e
+        track_handle = 0;
52408e
+    }
52408e
+
52408e
+    if (cmap_handle) {
52408e
+        cmap_finalize(cmap_handle);
52408e
+        cmap_handle = 0;
52408e
+    }
52408e
+}
52408e
+
52408e
 static gboolean
52408e
 sbd_get_two_node(void)
52408e
 {
52408e
@@ -217,18 +236,7 @@ sbd_get_two_node(void)
52408e
     return TRUE;
52408e
 
52408e
 out:
52408e
-    if (cmap_source) {
52408e
-        g_source_destroy(cmap_source);
52408e
-        cmap_source = NULL;
52408e
-    }
52408e
-    if (track_handle) {
52408e
-        cmap_track_delete(cmap_handle, track_handle);
52408e
-        track_handle = 0;
52408e
-    }
52408e
-    if (cmap_handle) {
52408e
-        cmap_finalize(cmap_handle);
52408e
-        cmap_handle = 0;
52408e
-    }
52408e
+    cmap_destroy();
52408e
 
52408e
     return FALSE;
52408e
 }
52408e
@@ -327,6 +335,12 @@ sbd_membership_destroy(gpointer user_data)
52408e
 {
52408e
     cl_log(LOG_WARNING, "Lost connection to %s", name_for_cluster_type(get_cluster_type()));
52408e
 
52408e
+    if (get_cluster_type() != pcmk_cluster_unknown) {
52408e
+#if SUPPORT_COROSYNC && CHECK_TWO_NODE
52408e
+        cmap_destroy();
52408e
+#endif
52408e
+    }
52408e
+
52408e
     set_servant_health(pcmk_health_unclean, LOG_ERR, "Cluster connection terminated");
52408e
     notify_parent();
52408e
 
52408e
-- 
52408e
1.8.3.1
52408e