提交 30c551ab 编写于 作者: H Hu Tao 提交者: Wen Congyang

qemu: fix a dead-lock problem

In qemuDomainObjBeginJobWithDriver, when virCondWaitUntil timeouts,
the function tries to call qemuDriverLock with virDomainObj locked,
this causes the dead-lock problem. This patch fixes this.
上级 5c53160a
...@@ -506,15 +506,17 @@ int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver, ...@@ -506,15 +506,17 @@ int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
while (priv->jobActive) { while (priv->jobActive) {
if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) { if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
/* Safe to ignore value since ref count was incremented above */
ignore_value(virDomainObjUnref(obj));
if (errno == ETIMEDOUT) if (errno == ETIMEDOUT)
qemuReportError(VIR_ERR_OPERATION_TIMEOUT, qemuReportError(VIR_ERR_OPERATION_TIMEOUT,
"%s", _("cannot acquire state change lock")); "%s", _("cannot acquire state change lock"));
else else
virReportSystemError(errno, virReportSystemError(errno,
"%s", _("cannot acquire job mutex")); "%s", _("cannot acquire job mutex"));
virDomainObjUnlock(obj);
qemuDriverLock(driver); qemuDriverLock(driver);
virDomainObjLock(obj);
/* Safe to ignore value since ref count was incremented above */
ignore_value(virDomainObjUnref(obj));
return -1; return -1;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册