mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
qemu: blockjob: Fix locking of block copy/active block commit
For the blockjobs, where libvirt is able to track the state internally we can fix locking of images we can remove the appropriate locks. Also when doing a pivoting operation we should not acquire the lock on any of those images since both are actually locked already. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1302168
This commit is contained in:
parent
f61e40610d
commit
b469853812
@ -33,6 +33,7 @@
|
||||
#include "virstoragefile.h"
|
||||
#include "virthread.h"
|
||||
#include "virtime.h"
|
||||
#include "locking/domain_lock.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||
|
||||
@ -139,17 +140,19 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX We want to revoke security labels and disk
|
||||
* lease, as well as audit that revocation, before
|
||||
* dropping the original source. But it gets tricky
|
||||
* if both source and mirror share common backing
|
||||
* files (we want to only revoke the non-shared
|
||||
* portion of the chain); so for now, we leak the
|
||||
* access to the original. */
|
||||
/* XXX We want to revoke security labels as well as audit that
|
||||
* revocation, before dropping the original source. But it gets
|
||||
* tricky if both source and mirror share common backing files (we
|
||||
* want to only revoke the non-shared portion of the chain); so for
|
||||
* now, we leak the access to the original. */
|
||||
virDomainLockImageDetach(driver->lockManager, vm, disk->src);
|
||||
virStorageSourceFree(disk->src);
|
||||
disk->src = disk->mirror;
|
||||
} else {
|
||||
virStorageSourceFree(disk->mirror);
|
||||
if (disk->mirror) {
|
||||
virDomainLockImageDetach(driver->lockManager, vm, disk->mirror);
|
||||
virStorageSourceFree(disk->mirror);
|
||||
}
|
||||
}
|
||||
|
||||
/* Recompute the cached backing chain to match our
|
||||
@ -172,8 +175,11 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
|
||||
|
||||
case VIR_DOMAIN_BLOCK_JOB_FAILED:
|
||||
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
|
||||
virStorageSourceFree(disk->mirror);
|
||||
disk->mirror = NULL;
|
||||
if (disk->mirror) {
|
||||
virDomainLockImageDetach(driver->lockManager, vm, disk->mirror);
|
||||
virStorageSourceFree(disk->mirror);
|
||||
disk->mirror = NULL;
|
||||
}
|
||||
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
|
||||
disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
|
||||
save = true;
|
||||
|
@ -16244,9 +16244,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
|
||||
if (disk->mirror->format &&
|
||||
disk->mirror->format != VIR_STORAGE_FILE_RAW &&
|
||||
(virDomainLockDiskAttach(driver->lockManager, cfg->uri, vm,
|
||||
disk) < 0 ||
|
||||
qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0 ||
|
||||
(qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0 ||
|
||||
qemuSetupDiskCgroup(vm, disk) < 0 ||
|
||||
qemuSecuritySetDiskLabel(driver, vm, disk) < 0))
|
||||
goto cleanup;
|
||||
|
Loading…
Reference in New Issue
Block a user