瀏覽代碼

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 (