From: "Daniel P. Berrange" <berrange(a)redhat.com>
If the qemuAgentClose method is called from a place which holds
the domain lock, it is theoretically possible to get a deadlock
in the agent destroy callback. This has not ben observed, but
the equivalent code in the QEMU monitor destroy callback has seen
a deadlock.
Remove the redundant locking while unrefing the object and the
bogus assignment
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_process.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c8c188a..42da617 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -129,7 +129,8 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent,
virDomainObjLock(vm);
priv = vm->privateData;
- priv->agent = NULL;
+ if (priv->agent == agent)
+ priv->agent = NULL;
virDomainObjUnlock(vm);
qemuDriverUnlock(driver);
@@ -167,16 +168,9 @@ qemuProcessHandleAgentError(qemuAgentPtr agent ATTRIBUTE_UNUSED,
static void qemuProcessHandleAgentDestroy(qemuAgentPtr agent,
virDomainObjPtr vm)
{
- qemuDomainObjPrivatePtr priv;
-
VIR_DEBUG("Received destroy agent=%p vm=%p", agent, vm);
- virDomainObjLock(vm);
- priv = vm->privateData;
- if (priv->agent == agent)
- priv->agent = NULL;
- if (virObjectUnref(vm))
- virDomainObjUnlock(vm);
+ virObjectUnref(vm);
}
--
1.7.11.2