[PATCH 4/4] Reload: Add atomic reload to log config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a reload is in progress, wait until it has all finished
before re-reading all of the logging parameters

Signed-off-by: Christine Caulfield <ccaulfie@xxxxxxxxxx>
---
 exec/logconfig.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/exec/logconfig.c b/exec/logconfig.c
index 0c9eeb4..e6f984a 100644
--- a/exec/logconfig.c
+++ b/exec/logconfig.c
@@ -542,6 +542,22 @@ static void main_logging_notify(
 #endif
 {
 	const char *error_string;
+	static int reload_in_progress = 0;
+
+	/* If a full reload happens then suspend updates for individual keys until
+	 * it's all completed
+	 */
+	if (strcmp(key_name, "config.reload_in_progress") == 0) {
+		if (*(uint8_t *)new_val.data == 1) {
+			reload_in_progress = 1;
+		} else {
+			reload_in_progress = 0;
+		}
+	}
+	if (reload_in_progress) {
+		log_printf(LOGSYS_LEVEL_DEBUG, "Ignoring key change, reload in progress. %s\n", key_name);
+		return;
+	}
 
 	/*
 	 * Reload the logsys configuration
@@ -562,6 +578,12 @@ static void add_logsys_config_notification(void)
 			main_logging_notify,
 			NULL,
 			&icmap_track);
+
+	icmap_track_add("config.reload_in_progress",
+			ICMAP_TRACK_ADD | ICMAP_TRACK_MODIFY,
+			main_logging_notify,
+			NULL,
+			&icmap_track);
 }
 #else
 static void add_logsys_config_notification(void)
@@ -573,6 +595,12 @@ static void add_logsys_config_notification(void)
 			main_logging_notify,
 			NULL,
 			&cmap_track);
+
+	cmap_track_add(cmap_handle, "config.reload_in_progress",
+			CMAP_TRACK_ADD | CMAP_TRACK_MODIFY,
+			main_logging_notify,
+			NULL,
+			&cmap_track);
 }
 #endif
 
-- 
1.8.1.4

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss




[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux