[Openais] [PATCH-COROSYNC] If syslog() blocked, node-leave events were incorrectly reported

Angus & Anna Salkeld ahsalkeld at gmail.com
Wed Sep 17 02:32:59 PDT 2008


In some cases, the syslog() call may block. If this happened, the AIS worker
thread would block waiting on the syslog() call. However, the worker thread
is still holding a logsys mutex, which is needed to enqueue any more log
messages from the other AIS threads. So the main AIS thread blocks waiting
on the logsys mutex. This can then cause aisexec on other nodes to detect
the node as leaving the cluster.

Author: Tim Beale <tim.beale at alliedtelesis.co.nz>
---
 exec/logsys.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/exec/logsys.c b/exec/logsys.c
index bc519f1..425d0e2 100644
--- a/exec/logsys.c
+++ b/exec/logsys.c
@@ -274,6 +274,10 @@ static void log_printf_worker_fn (void
*thread_data, void *work_item)
 		fflush (stdout);
 	}

+	/* release mutex here in case syslog blocks */
+	if (logsys_wthread_active)
+		pthread_mutex_unlock (&logsys_config_mutex);
+
 	if ((logsys_mode & LOG_MODE_OUTPUT_SYSLOG_THREADED) &&
 		(!((logsys_mode & LOG_MODE_FILTER_DEBUG_FROM_SYSLOG) &&
 		   (log_data->priority == LOG_LEVEL_DEBUG)))) {
@@ -281,8 +285,6 @@ static void log_printf_worker_fn (void
*thread_data, void *work_item)
 			&log_data->log_string[log_data->syslog_pos]);
 	}
 	free (log_data->log_string);
-	if (logsys_wthread_active)
-		pthread_mutex_unlock (&logsys_config_mutex);
 }

 static void _log_printf (
--


More information about the Openais mailing list