File 0001-qnetd-Fix-dpd-timer.patch of Package corosync

From cfa2502db27115abe622438ca26a4d7f9b6e4dbb Mon Sep 17 00:00:00 2001
From: Jan Friesse <jfriesse@redhat.com>
Date: Tue, 15 Sep 2020 15:10:53 +0200
Subject: [PATCH] qnetd: Fix dpd timer

With default config of running dpd timer every 10 second and waiting for
2 * client_timeout to clear message received flag and then waiting
another 2 * client_timeout without message received it was possible that
client was marked as a dead after more than 40 seconds making qdevice to
stop sending votequorum hearbeat for too long so corosync lost votes
from qdevice.

This patch is simpler solution which just changes default dpd timer to
1 second and timeout to 1.2 * client_timeout.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>

(cherry picked from corosync-qdevice project commit
 11a861c93fe4b0594afb60a3993d5ba9f443fba5)
---
 man/corosync-qnetd.8       | 6 +++---
 qdevices/qnet-config.h     | 4 ++--
 qdevices/qnetd-dpd-timer.c | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/man/corosync-qnetd.8 b/man/corosync-qnetd.8
index 2983ae5d..3ae5531b 100644
--- a/man/corosync-qnetd.8
+++ b/man/corosync-qnetd.8
@@ -1,5 +1,5 @@
 .\"/*
-.\" * Copyright (C) 2016-2019 Red Hat, Inc.
+.\" * Copyright (C) 2016-2020 Red Hat, Inc.
 .\" *
 .\" * All rights reserved.
 .\" *
@@ -31,7 +31,7 @@
 .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" * THE POSSIBILITY OF SUCH DAMAGE.
 .\" */
-.TH COROSYNC-QNETD 8 2019-08-12
+.TH COROSYNC-QNETD 8 2020-09-15
 .SH NAME
 corosync-qnetd \- QNet daemon
 .SH SYNOPSIS
@@ -217,7 +217,7 @@ Maximum heartbeat timeout accepted by server in ms. (120000)
 Dead peer detection enabled. (on)
 .TP
 .B dpd_interval
-How often the DPD algorithm detects dead peers in ms. (10000)
+How often the DPD algorithm detects dead peers in ms. (1000)
 .TP
 .B lock_file
 Lock file location. (/var/run/corosync-qnetd/corosync-qnetd.pid)
diff --git a/qdevices/qnet-config.h b/qdevices/qnet-config.h
index 8435b53f..3a9df193 100644
--- a/qdevices/qnet-config.h
+++ b/qdevices/qnet-config.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016 Red Hat, Inc.
+ * Copyright (c) 2015-2020 Red Hat, Inc.
  *
  * All rights reserved.
  *
@@ -71,7 +71,7 @@ extern "C" {
 #define QNETD_MIN_HEARTBEAT_INTERVAL			1
 
 #define QNETD_DEFAULT_DPD_ENABLED			1
-#define QNETD_DEFAULT_DPD_INTERVAL			(10*1000)
+#define QNETD_DEFAULT_DPD_INTERVAL			(1*1000)
 #define QNETD_MIN_DPD_INTERVAL				1
 
 #define QNETD_DEFAULT_LOCK_FILE				LOCALSTATEDIR"/run/corosync-qnetd/corosync-qnetd.pid"
diff --git a/qdevices/qnetd-dpd-timer.c b/qdevices/qnetd-dpd-timer.c
index c23aa2e0..5e80f5c0 100644
--- a/qdevices/qnetd-dpd-timer.c
+++ b/qdevices/qnetd-dpd-timer.c
@@ -50,7 +50,7 @@ qnetd_dpd_timer_cb(void *data1, void *data2)
 
 		client->dpd_time_since_last_check += instance->advanced_settings->dpd_interval;
 
-		if (client->dpd_time_since_last_check > (client->heartbeat_interval * 2)) {
+		if (client->dpd_time_since_last_check > client->heartbeat_interval * 1.2) {
 			if (!client->dpd_msg_received_since_last_check) {
 				log(LOG_WARNING, "Client %s doesn't sent any message during "
 				    "%"PRIu32"ms. Disconnecting",
-- 
2.26.2

openSUSE Build Service is sponsored by