]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: avoid qemu_driver being unlocked twice when virThreadPoolNew() failed
authorWen Congyang <wency@cn.fujitsu.com>
Wed, 6 Apr 2011 07:53:11 +0000 (15:53 +0800)
committerWen Congyang <wency@cn.fujitsu.com>
Mon, 18 Apr 2011 01:38:45 +0000 (09:38 +0800)
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.

src/qemu/qemu_driver.c

index c1a44c959394a7b5cea4bef31f839df5116fcb3f..d5c1274e7efefcbbd42752f89ce52d8c7be25f52 100644 (file)
@@ -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);