...
diff --git a/src/util/util.c b/src/util/util.c
index cf1290d..901c0d2 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -415,12 +415,19 @@ __virExec(virConnectPtr conn,
childerr = null;
}
+ /* Ensure we hold the logging lock, to protect child processes
+ * from deadlocking on another threads inheirited mutex state */
+ virLogLock();
+
if ((pid = fork()) < 0) {
virReportSystemError(conn, errno,
"%s", _("cannot fork child process"));
goto cleanup;
}
+ /* Unlock for both parent and child process */
+ virLogUnlock();
+
if (pid) { /* parent */
close(null);
if (outfd && *outfd == -1) {
Hmm, shouldn't we virLogUnlock() even if fork() fails? That is, something
like:
virLogLock();
pid = fork();
virLogUnlock();
if (pid < 0)
error;
else if (pid)
parent;
...
Jirka