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

70e21d
From cdf72925db5a81e546ca8e8d7d8291ee1fc77be4 Mon Sep 17 00:00:00 2001
70e21d
From: Jan Friesse <jfriesse@redhat.com>
70e21d
Date: Wed, 11 Aug 2021 17:34:05 +0200
70e21d
Subject: [PATCH] totem: Add cancel_hold_on_retransmit config option
70e21d
70e21d
Previously, existence of retransmit messages canceled holding
70e21d
of token (and never allowed representative to enter token hold
70e21d
state).
70e21d
70e21d
This makes token rotating maximum speed and keeps processor
70e21d
resending messages over and over again - overloading network
70e21d
and reducing chance to successfully deliver the messages.
70e21d
70e21d
Also there were reports of various Antivirus / IPS / IDS which slows
70e21d
down delivery of packets with certain sizes (packets bigger than token)
70e21d
what make Corosync retransmit messages over and over again.
70e21d
70e21d
Proposed solution is to allow representative to enter token hold
70e21d
state when there are only retransmit messages. This allows network to
70e21d
handle overload and/or gives Antivirus/IPS/IDS enough time scan and
70e21d
deliver packets without corosync entering "FAILED TO RECEIVE" state and
70e21d
adding more load to network.
70e21d
70e21d
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
70e21d
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
70e21d
---
70e21d
 exec/totemconfig.c             |  6 ++++++
70e21d
 exec/totemsrp.c                |  5 +++--
70e21d
 include/corosync/totem/totem.h |  2 ++
70e21d
 man/corosync.conf.5            | 15 ++++++++++++++-
70e21d
 4 files changed, 25 insertions(+), 3 deletions(-)
70e21d
70e21d
diff --git a/exec/totemconfig.c b/exec/totemconfig.c
70e21d
index 57a1587a..46e09952 100644
70e21d
--- a/exec/totemconfig.c
70e21d
+++ b/exec/totemconfig.c
70e21d
@@ -81,6 +81,7 @@
70e21d
 #define MAX_MESSAGES				17
70e21d
 #define MISS_COUNT_CONST			5
70e21d
 #define BLOCK_UNLISTED_IPS			1
70e21d
+#define CANCEL_TOKEN_HOLD_ON_RETRANSMIT		0
70e21d
 /* This constant is not used for knet */
70e21d
 #define UDP_NETMTU                              1500
70e21d
 
70e21d
@@ -144,6 +145,8 @@ static void *totem_get_param_by_name(struct totem_config *totem_config, const ch
70e21d
 		return totem_config->knet_compression_model;
70e21d
 	if (strcmp(param_name, "totem.block_unlisted_ips") == 0)
70e21d
 		return &totem_config->block_unlisted_ips;
70e21d
+	if (strcmp(param_name, "totem.cancel_token_hold_on_retransmit") == 0)
70e21d
+		return &totem_config->cancel_token_hold_on_retransmit;
70e21d
 
70e21d
 	return NULL;
70e21d
 }
70e21d
@@ -365,6 +368,9 @@ void totem_volatile_config_read (struct totem_config *totem_config, icmap_map_t
70e21d
 
70e21d
 	totem_volatile_config_set_boolean_value(totem_config, temp_map, "totem.block_unlisted_ips", deleted_key,
70e21d
 	    BLOCK_UNLISTED_IPS);
70e21d
+
70e21d
+	totem_volatile_config_set_boolean_value(totem_config, temp_map, "totem.cancel_token_hold_on_retransmit",
70e21d
+	    deleted_key, CANCEL_TOKEN_HOLD_ON_RETRANSMIT);
70e21d
 }
70e21d
 
70e21d
 int totem_volatile_config_validate (
70e21d
diff --git a/exec/totemsrp.c b/exec/totemsrp.c
70e21d
index 949d367b..d24b11fa 100644
70e21d
--- a/exec/totemsrp.c
70e21d
+++ b/exec/totemsrp.c
70e21d
@@ -3981,8 +3981,9 @@ static int message_handler_orf_token (
70e21d
 		transmits_allowed = fcc_calculate (instance, token);
70e21d
 		mcasted_retransmit = orf_token_rtr (instance, token, &transmits_allowed);
70e21d
 
70e21d
-		if (instance->my_token_held == 1 &&
70e21d
-			(token->rtr_list_entries > 0 || mcasted_retransmit > 0)) {
70e21d
+		if (instance->totem_config->cancel_token_hold_on_retransmit &&
70e21d
+		    instance->my_token_held == 1 &&
70e21d
+		    (token->rtr_list_entries > 0 || mcasted_retransmit > 0)) {
70e21d
 			instance->my_token_held = 0;
70e21d
 			forward_token = 1;
70e21d
 		}
70e21d
diff --git a/include/corosync/totem/totem.h b/include/corosync/totem/totem.h
70e21d
index 8b166566..bdb6a15f 100644
70e21d
--- a/include/corosync/totem/totem.h
70e21d
+++ b/include/corosync/totem/totem.h
70e21d
@@ -244,6 +244,8 @@ struct totem_config {
70e21d
 
70e21d
 	unsigned int block_unlisted_ips;
70e21d
 
70e21d
+	unsigned int cancel_token_hold_on_retransmit;
70e21d
+
70e21d
 	void (*totem_memb_ring_id_create_or_load) (
70e21d
 	    struct memb_ring_id *memb_ring_id,
70e21d
 	    unsigned int nodeid);
70e21d
diff --git a/man/corosync.conf.5 b/man/corosync.conf.5
70e21d
index 0588ad1e..a3771ea7 100644
70e21d
--- a/man/corosync.conf.5
70e21d
+++ b/man/corosync.conf.5
70e21d
@@ -32,7 +32,7 @@
70e21d
 .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
70e21d
 .\" * THE POSSIBILITY OF SUCH DAMAGE.
70e21d
 .\" */
70e21d
-.TH COROSYNC_CONF 5 2021-07-23 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
70e21d
+.TH COROSYNC_CONF 5 2021-08-11 "corosync Man Page" "Corosync Cluster Engine Programmer's Manual"
70e21d
 .SH NAME
70e21d
 corosync.conf - corosync executive configuration file
70e21d
 
70e21d
@@ -584,6 +584,19 @@ with an old configuration.
70e21d
 
70e21d
 The default value is yes.
70e21d
 
70e21d
+.TP
70e21d
+cancel_token_hold_on_retransmit
70e21d
+Allows Corosync to hold token by representative when there is too much
70e21d
+retransmit messages. This allows network to process increased load without
70e21d
+overloading it. Used mechanism is same as described for
70e21d
+.B hold
70e21d
+directive.
70e21d
+
70e21d
+Some deployments may prefer to never hold token when there is
70e21d
+retransmit messages. If so, option should be set to yes.
70e21d
+
70e21d
+The default value is no.
70e21d
+
70e21d
 .PP
70e21d
 Within the
70e21d
 .B logging
70e21d
-- 
70e21d
2.27.0
70e21d