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

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