1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

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.
This commit is contained in:
Wen Congyang 2011-04-06 15:53:11 +08:00
parent cf7124946a
commit 847efb32de

View 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);