mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-09 05:01:28 +00:00
Fix locking in qemudDomainMemoryStats
When adding domainMemoryStats API support for the qemu driver, I didn't follow the locking rules exactly. The job condition must be held when executing monitor commands. This corrects the segfaults I was seeing when calling domainMemoryStats in a multi-threaded environment. * src/qemu/qemu_driver.c: in qemudDomainMemoryStats() add missing calls to qemuDomainObjBeginJob/qemuDomainObjEndJob
This commit is contained in:
parent
ecb5cf7cb2
commit
5140a2f626
@ -7708,6 +7708,9 @@ qemudDomainMemoryStats (virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (qemuDomainObjBeginJob(vm) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (virDomainObjIsActive(vm)) {
|
if (virDomainObjIsActive(vm)) {
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
qemuDomainObjEnterMonitor(vm);
|
qemuDomainObjEnterMonitor(vm);
|
||||||
@ -7718,6 +7721,9 @@ qemudDomainMemoryStats (virDomainPtr dom,
|
|||||||
"%s", _("domain is not running"));
|
"%s", _("domain is not running"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (qemuDomainObjEndJob(vm) == 0)
|
||||||
|
vm = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (vm)
|
if (vm)
|
||||||
virDomainObjUnlock(vm);
|
virDomainObjUnlock(vm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user