qemu: Fix a possible deadlock in p2p migration

The function virUnrefConnect() may call virReleaseConnect() to release
the dest connection, and the function virReleaseConnect() will call
conn->driver->close().

So the function virUnrefConnect() should be surrounded by
qemuDomainObjEnterRemoteWithDriver() and
qemuDomainObjExitRemoteWithDriver() to prevent possible deadlock between
two communicating libvirt daemons.

See commit f0c8e1cb37 for further details.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
This commit is contained in:
Wen Congyang 2011-01-21 16:28:07 +08:00 committed by Eric Blake
parent 3703c3fed4
commit bda57661b8
1 changed files with 2 additions and 0 deletions

View File

@ -8790,7 +8790,9 @@ static int doPeer2PeerMigrate(virDomainPtr dom,
cleanup:
VIR_FREE(dom_xml);
/* don't call virConnectClose(), because that resets any pending errors */
qemuDomainObjEnterRemoteWithDriver(driver, vm);
virUnrefConnect(dconn);
qemuDomainObjExitRemoteWithDriver(driver, vm);
return ret;
}