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