Просмотр исходного кода

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>
Jan Friesse 2 дней назад
Родитель
Сommit
29206cdf69
3 измененных файлов с 11 добавлено и 6 удалено
  1. 3 0
      exec/cfg.c
  2. 4 6
      exec/totemconfig.c
  3. 4 0
      exec/totemconfig.h

+ 3 - 0
exec/cfg.c

@@ -801,6 +801,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);

+ 4 - 6
exec/totemconfig.c

@@ -1121,7 +1121,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;
@@ -1138,7 +1138,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 =
@@ -1146,7 +1146,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);
 		}
 	}
 }
@@ -2014,7 +2014,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()); */
@@ -2430,8 +2430,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);
 

+ 4 - 0
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 */