public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH corosync] cherry-pick fix for updating knet timeouts on token timeout change
@ 2026-02-13 10:11 Friedrich Weber
  0 siblings, 0 replies; only message in thread
From: Friedrich Weber @ 2026-02-13 10:11 UTC (permalink / raw)
  To: pve-devel

When updating the token timeout of a running cluster (e.g. by changing
token_coefficient in corosync.conf), kronosnet's knet_ping_timeout and
knet_ping_interval were not updated due to a corosync bug [1].
Backport the fix to ensure all timeouts are correctly updated in case
users change the token_coefficient.

[1] https://github.com/corosync/corosync/issues/813

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
---
 ...g-Fix-knet-ping-timer-calc-on-reload.patch | 111 ++++++++++++++++++
 debian/patches/series                         |   1 +
 2 files changed, 112 insertions(+)
 create mode 100644 debian/patches/0004-totemconfig-Fix-knet-ping-timer-calc-on-reload.patch

diff --git a/debian/patches/0004-totemconfig-Fix-knet-ping-timer-calc-on-reload.patch b/debian/patches/0004-totemconfig-Fix-knet-ping-timer-calc-on-reload.patch
new file mode 100644
index 0000000..d8d078f
--- /dev/null
+++ b/debian/patches/0004-totemconfig-Fix-knet-ping-timer-calc-on-reload.patch
@@ -0,0 +1,111 @@
+From 51f361d38b2a6799a0b59f5b0b9ccb1a2ea03e22 Mon Sep 17 00:00:00 2001
+From: Jan Friesse <jfriesse@redhat.com>
+Date: Wed, 11 Feb 2026 18:30:47 +0100
+Subject: [PATCH] totemconfig: Fix knet ping timer calc on reload
+
+calc_knet_ping_timers relies on the totem timeout, which is set by
+totem_volatile_config_read. Therefore, it must be called last.
+
+Previously, during a reload, the calculation was called as part of
+totemconfig_configure_new_params, which runs before
+totem_volatile_config_read. This caused the calculation to ignore
+the new token timeout.
+
+The solution is to call it after totemconfig_configure_new_params in
+message_handler_req_exec_cfg_reload_config, mirroring the behavior
+during the initial load in totem_config_read.
+
+This requires exporting the function and allowing the use of a
+different icmap than the global one.
+
+Fixes #813
+
+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
+Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
+(cherry picked from commit 29206cdf698fbfda506222cf598ebf2a76764163)
+Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
+---
+ exec/cfg.c         |  3 +++
+ exec/totemconfig.c | 10 ++++------
+ exec/totemconfig.h |  4 ++++
+ 3 files changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/exec/cfg.c b/exec/cfg.c
+index 1c4e0d57..267f172b 100644
+--- a/exec/cfg.c
++++ b/exec/cfg.c
+@@ -798,6 +798,9 @@ static void message_handler_req_exec_cfg_reload_config (
+ 		goto reload_fini;
+ 	}
+ 
++	/* knet ping timers when unset depends on token timeout so this needs to be done last of all */
++	totem_calc_knet_ping_timers(&new_config, temp_map);
++
+ 	/* Validate dynamic parameters */
+ 	if (totem_volatile_config_validate(&new_config, temp_map, &error_string) == -1) {
+ 		log_printf (LOGSYS_LEVEL_ERROR, "Configuration is not valid: %s\n", error_string);
+diff --git a/exec/totemconfig.c b/exec/totemconfig.c
+index 505424e3..41fd74da 100644
+--- a/exec/totemconfig.c
++++ b/exec/totemconfig.c
+@@ -1120,7 +1120,7 @@ static int check_for_duplicate_nodeids(
+  * interface params, but the totem params need to have them to be read first. We
+  * need both, so this is a way round that circular dependancy.
+  */
+-static void calc_knet_ping_timers(struct totem_config *totem_config)
++void totem_calc_knet_ping_timers(struct totem_config *totem_config, icmap_map_t temp_map)
+ {
+ 	char runtime_key_name[ICMAP_KEYNAME_MAXLEN];
+ 	int interface;
+@@ -1137,7 +1137,7 @@ static void calc_knet_ping_timers(struct totem_config *totem_config)
+ 			}
+ 			snprintf(runtime_key_name, sizeof(runtime_key_name),
+ 				 "runtime.config.totem.interface.%d.knet_ping_timeout", interface);
+-			icmap_set_uint32(runtime_key_name, totem_config->interfaces[interface].knet_ping_timeout);
++			icmap_set_uint32_r(temp_map, runtime_key_name, totem_config->interfaces[interface].knet_ping_timeout);
+ 
+ 			if (!totem_config->interfaces[interface].knet_ping_interval) {
+ 				totem_config->interfaces[interface].knet_ping_interval =
+@@ -1145,7 +1145,7 @@ static void calc_knet_ping_timers(struct totem_config *totem_config)
+ 			}
+ 			snprintf(runtime_key_name, sizeof(runtime_key_name),
+ 				 "runtime.config.totem.interface.%d.knet_ping_interval", interface);
+-			icmap_set_uint32(runtime_key_name, totem_config->interfaces[interface].knet_ping_interval);
++			icmap_set_uint32_r(temp_map, runtime_key_name, totem_config->interfaces[interface].knet_ping_interval);
+ 		}
+ 	}
+ }
+@@ -1991,7 +1991,7 @@ extern int totem_config_read (
+ 	 */
+ 	totem_volatile_config_read(totem_config, icmap_get_global_map(), NULL);
+ 
+-	calc_knet_ping_timers(totem_config);
++	totem_calc_knet_ping_timers(totem_config, icmap_get_global_map());
+ 
+ 	/* This is now done in the totemknet interface callback */
+ 	/*	configure_totem_links(totem_config, icmap_get_global_map()); */
+@@ -2407,8 +2407,6 @@ int totemconfig_configure_new_params(
+ 		return -1;
+ 	}
+ 
+-	calc_knet_ping_timers(totem_config);
+-
+ 	log_printf(LOGSYS_LEVEL_DEBUG, "Configuration reloaded. Dumping actual totem config.");
+ 	debug_dump_totem_config(totem_config);
+ 
+diff --git a/exec/totemconfig.h b/exec/totemconfig.h
+index a0b2e10d..51dc8dd5 100644
+--- a/exec/totemconfig.h
++++ b/exec/totemconfig.h
+@@ -90,4 +90,8 @@ extern int totemconfig_commit_new_params(
+ 	struct totem_config *totem_config,
+ 	icmap_map_t map);
+ 
++extern void totem_calc_knet_ping_timers(
++	struct totem_config *totem_config,
++	icmap_map_t temp_map);
++
+ #endif /* TOTEMCONFIG_H_DEFINED */
+-- 
+2.47.3
+
diff --git a/debian/patches/series b/debian/patches/series
index 147e793..656a135 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Enable-PrivateTmp-in-the-systemd-service-files.patch
 0002-only-start-corosync.service-if-conf-exists.patch
 0003-totemsrp-Check-size-of-orf_token-msg.patch
+0004-totemconfig-Fix-knet-ping-timer-calc-on-reload.patch
-- 
2.47.3





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-13 10:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-13 10:11 [PATCH corosync] cherry-pick fix for updating knet timeouts on token timeout change Friedrich Weber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal