From: Wen Congyang Date: Wed, 6 Apr 2011 07:53:11 +0000 (+0800) Subject: qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=847efb32de3467801924cc901d2cf80e9d7c48de;p=libvirt.git qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed We do not lock qemu_driver when calling virThreadPoolNew(). If it failed, we will unlock qemu_driver. It is dangerous. We may use this pool during auto starting domains. So we must create it before calling qemuAutostartDomains(). Otherwise, libvirtd will crash. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c1a44c9593..d5c1274e7e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -625,14 +625,14 @@ qemudStartup(int privileged) { virHashForEach(qemu_driver->domains.objs, qemuDomainSnapshotLoad, qemu_driver->snapshotDir); - qemuDriverUnlock(qemu_driver); - - qemuAutostartDomains(qemu_driver); - qemu_driver->workerPool = virThreadPoolNew(0, 1, processWatchdogEvent, qemu_driver); if (!qemu_driver->workerPool) goto error; + qemuDriverUnlock(qemu_driver); + + qemuAutostartDomains(qemu_driver); + if (conn) virConnectClose(conn);