Blame SOURCES/bz2001969-1-totem-Add-cancel_hold_on_retransmit-config-option.patch

da48c0
From 64010f573801b73222e80821a19140c59b003f5c Mon Sep 17 00:00:00 2001
da48c0
From: Jan Friesse <jfriesse@redhat.com>
da48c0
Date: Thu, 19 Aug 2021 16:13:53 +0200
da48c0
Subject: [PATCH] totem: Add cancel_hold_on_retransmit config option
da48c0
da48c0
Previously, existence of retransmit messages canceled holding
da48c0
of token (and never allowed representative to enter token hold
da48c0
state).
da48c0
da48c0
This makes token rotating maximum speed and keeps processor
da48c0
resending messages over and over again - overloading network
da48c0
and reducing chance to successfully deliver the messages.
da48c0
da48c0
Also there were reports of various Antivirus / IPS / IDS which slows
da48c0
down delivery of packets with certain sizes (packets bigger than token)
da48c0
what make Corosync retransmit messages over and over again.
da48c0
da48c0
Proposed solution is to allow representative to enter token hold
da48c0
state when there are only retransmit messages. This allows network to
da48c0
handle overload and/or gives Antivirus/IPS/IDS enough time scan and
da48c0
deliver packets without corosync entering "FAILED TO RECEIVE" state and
da48c0
adding more load to network.
da48c0
da48c0
(backported from master cdf72925db5a81e546ca8e8d7d8291ee1fc77be4)
da48c0
da48c0
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
da48c0
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
da48c0
---
da48c0
 exec/totemconfig.c             |  6 ++++++
da48c0
 exec/totemsrp.c                |  5 +++--
da48c0
 include/corosync/totem/totem.h |  2 ++
da48c0
 man/corosync.conf.5            | 15 ++++++++++++++-
da48c0
 4 files changed, 25 insertions(+), 3 deletions(-)
da48c0
da48c0
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
da48c0
index 38da46b5..a9d8fcf5 100644
da48c0
--- a/exec/totemconfig.c
da48c0
+++ b/exec/totemconfig.c
da48c0
@@ -78,6 +78,7 @@
da48c0
 #define RRP_PROBLEM_COUNT_THRESHOLD_MIN		2
da48c0
 #define RRP_AUTORECOVERY_CHECK_TIMEOUT		1000
da48c0
 #define BLOCK_UNLISTED_IPS			1
da48c0
+#define CANCEL_TOKEN_HOLD_ON_RETRANSMIT		0
da48c0
 
da48c0
 #define DEFAULT_PORT				5405
da48c0
 
da48c0
@@ -133,6 +134,8 @@ static uint32_t *totem_get_param_by_name(struct totem_config *totem_config, cons
da48c0
 		return &totem_config->miss_count_const;
da48c0
 	if (strcmp(param_name, "totem.block_unlisted_ips") == 0)
da48c0
 		return &totem_config->block_unlisted_ips;
da48c0
+	if (strcmp(param_name, "totem.cancel_token_hold_on_retransmit") == 0)
da48c0
+		return &totem_config->cancel_token_hold_on_retransmit;
da48c0
 
da48c0
 	return NULL;
da48c0
 }
da48c0
@@ -293,6 +296,9 @@ static void totem_volatile_config_read (struct totem_config *totem_config, const
da48c0
 
da48c0
 	totem_volatile_config_set_boolean_value(totem_config, "totem.block_unlisted_ips", deleted_key,
da48c0
 	    BLOCK_UNLISTED_IPS);
da48c0
+
da48c0
+	totem_volatile_config_set_boolean_value(totem_config, "totem.cancel_token_hold_on_retransmit",
da48c0
+	    deleted_key, CANCEL_TOKEN_HOLD_ON_RETRANSMIT);
da48c0
 }
da48c0
 
da48c0
 static int totem_volatile_config_validate (
da48c0
diff --git a/exec/totemsrp.c b/exec/totemsrp.c
da48c0
index 41c2deee..269c6e6c 100644
da48c0
--- a/exec/totemsrp.c
da48c0
+++ b/exec/totemsrp.c
da48c0
@@ -4105,8 +4105,9 @@ static int message_handler_orf_token (
da48c0
 		transmits_allowed = fcc_calculate (instance, token);
da48c0
 		mcasted_retransmit = orf_token_rtr (instance, token, &transmits_allowed);
da48c0
 
da48c0
-		if (instance->my_token_held == 1 &&
da48c0
-			(token->rtr_list_entries > 0 || mcasted_retransmit > 0)) {
da48c0
+		if (instance->totem_config->cancel_token_hold_on_retransmit &&
da48c0
+		    instance->my_token_held == 1 &&
da48c0
+		    (token->rtr_list_entries > 0 || mcasted_retransmit > 0)) {
da48c0
 			instance->my_token_held = 0;
da48c0
 			forward_token = 1;
da48c0
 		}
da48c0
diff --git a/include/corosync/totem/totem.h b/include/corosync/totem/totem.h
da48c0
index 86968817..90f3cf17 100644
da48c0
--- a/include/corosync/totem/totem.h
da48c0
+++ b/include/corosync/totem/totem.h
da48c0
@@ -193,6 +193,8 @@ struct totem_config {
da48c0
 
da48c0
 	unsigned int block_unlisted_ips;
da48c0
 
da48c0
+	unsigned int cancel_token_hold_on_retransmit;
da48c0
+
da48c0
 	void (*totem_memb_ring_id_create_or_load) (
da48c0
 	    struct memb_ring_id *memb_ring_id,
da48c0
 	    const struct totem_ip_address *addr);
da48c0
diff --git a/man/corosync.conf.5 b/man/corosync.conf.5
da48c0
index 0487794d..5685da4e 100644
da48c0
--- a/man/corosync.conf.5
da48c0
+++ b/man/corosync.conf.5
da48c0
@@ -32,7 +32,7 @@
da48c0
 .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
da48c0
 .\" * THE POSSIBILITY OF SUCH DAMAGE.
da48c0
 .\" */
da48c0
-.TH COROSYNC_CONF 5 2019-05-23 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
da48c0
+.TH COROSYNC_CONF 5 2021-08-19 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
da48c0
 .SH NAME
da48c0
 corosync.conf - corosync executive configuration file
da48c0
 
da48c0
@@ -539,6 +539,19 @@ with an old configuration.
da48c0
 
da48c0
 The default value is yes.
da48c0
 
da48c0
+.TP
da48c0
+cancel_token_hold_on_retransmit
da48c0
+Allows Corosync to hold token by representative when there is too much
da48c0
+retransmit messages. This allows network to process increased load without
da48c0
+overloading it. Used mechanism is same as described for
da48c0
+.B hold
da48c0
+directive.
da48c0
+
da48c0
+Some deployments may prefer to never hold token when there is
da48c0
+retransmit messages. If so, option should be set to yes.
da48c0
+
da48c0
+The default value is no.
da48c0
+
da48c0
 .PP
da48c0
 Within the
da48c0
 .B logging
da48c0
-- 
da48c0
2.27.0
da48c0