mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
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.
This commit is contained in:
parent
5c53160a2f
commit
30c551ab4e
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user