
At 03/30/2011 09:49 AM, Hu Tao Write:
--- src/qemu/qemu_driver.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 104e92d..6e3edde 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2068,12 +2068,14 @@ static int qemudDomainSave(virDomainPtr dom, const char *path) qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Invalid save image format specified " "in configuration file")); + qemuDriverUnlock(driver); return -1; } if (!qemudCompressProgramAvailable(compressed)) { qemuReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Compression program for image format " "in configuration file isn't available")); + qemuDriverUnlock(driver); return -1; } }
I checked all the place where calling qemuDriverLock(), and I found 2 similar problem: 1. qemudStartup(): ================= *qemuDriverUnlock(qemu_driver);* qemuAutostartDomains(qemu_driver); qemu_driver->workerPool = virThreadPoolNew(0, 1, processWatchdogEvent, qemu_driver); if (!qemu_driver->workerPool) goto error; if (conn) virConnectClose(conn); return 0; out_of_memory: virReportOOMError(); error: if (qemu_driver) *qemuDriverUnlock(qemu_driver);* ================= We unlock qemu_driver twice when virThreadPoolNew() failed. I think we should lock qemu_driver again before calling virThreadPoolNew(). 2. processWatchdogEvent(): ================= switch (wdEvent->action) { case VIR_DOMAIN_WATCHDOG_ACTION_DUMP: { .... qemuDriverLock(driver); virDomainObjLock(wdEvent->vm); if (qemuDomainObjBeginJobWithDriver(driver, wdEvent->vm) < 0) break; if (!virDomainObjIsActive(wdEvent->vm)) { qemuReportError(VIR_ERR_OPERATION_INVALID, "%s", _("domain is not running")); break; } ================= We lock qemu_driver and vm, but we do not unlock them when qemuDomainObjBeginJobWithDriver() failed or the vm is not running.