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

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