mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
qemu: fix one more race on undefining and create
[1] closes gap in virDomainObjListRemove so that concurrent thread can
not step in and obtain the domain while domain is temporary unlocked. But
there is another gap exist:
thread B - executes create API
thread C - executes undefine API
- thread A executes some job on domain
- threads B and C obtains domain from list and wait for job condition
- thread A finishes its job and C grabs job condition, removes domain
from list and finishes
- thread B grabs job condition and start the domain, unfortunately
is not in the list already
[1] commit c7d1c139ca
Author: Martin Kletzander <mkletzan@redhat.com>
Date: Thu Dec 11 11:14:08 2014 +0100
qemu: avoid rare race when undefining domain
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@openvz.org>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
e55302596b
commit
f647a4b8dd
@ -849,6 +849,16 @@ qemuDomainObjBeginJobInternal(virQEMUDriver *driver,
|
||||
if (!nested && !qemuDomainNestedJobAllowed(&priv->job, job))
|
||||
goto retry;
|
||||
|
||||
if (obj->removing) {
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
|
||||
virUUIDFormat(obj->def->uuid, uuidstr);
|
||||
virReportError(VIR_ERR_NO_DOMAIN,
|
||||
_("no domain with matching uuid '%s' (%s)"),
|
||||
uuidstr, obj->def->name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
ignore_value(virTimeMillisNow(&now));
|
||||
|
||||
if (job) {
|
||||
|
Loading…
Reference in New Issue
Block a user