提交 362d0477 编写于 作者: D Daniel P. Berrange

Fix potential deadlock when agent is closed

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 been 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: NDaniel P. Berrange <berrange@redhat.com>
上级 5cbb0d37
...@@ -129,6 +129,7 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent, ...@@ -129,6 +129,7 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent,
virDomainObjLock(vm); virDomainObjLock(vm);
priv = vm->privateData; priv = vm->privateData;
if (priv->agent == agent)
priv->agent = NULL; priv->agent = NULL;
virDomainObjUnlock(vm); virDomainObjUnlock(vm);
...@@ -167,16 +168,9 @@ qemuProcessHandleAgentError(qemuAgentPtr agent ATTRIBUTE_UNUSED, ...@@ -167,16 +168,9 @@ qemuProcessHandleAgentError(qemuAgentPtr agent ATTRIBUTE_UNUSED,
static void qemuProcessHandleAgentDestroy(qemuAgentPtr agent, static void qemuProcessHandleAgentDestroy(qemuAgentPtr agent,
virDomainObjPtr vm) virDomainObjPtr vm)
{ {
qemuDomainObjPrivatePtr priv;
VIR_DEBUG("Received destroy agent=%p vm=%p", agent, vm); VIR_DEBUG("Received destroy agent=%p vm=%p", agent, vm);
virDomainObjLock(vm); virObjectUnref(vm);
priv = vm->privateData;
if (priv->agent == agent)
priv->agent = NULL;
if (virObjectUnref(vm))
virDomainObjUnlock(vm);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册