Преглед на файлове

If syslog() blocked, node-leave events were incorrectly reported

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@alliedtelesis.co.nz>


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1665 fd59a12c-fef9-0310-b244-a6a79926bd2f
Angus Salkeld преди 17 години
родител
ревизия
9655fa2fea
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4 2
      exec/logsys.c

+ 4 - 2
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 (