mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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 "virstoragefile.h"
|
||||||
#include "virthread.h"
|
#include "virthread.h"
|
||||||
#include "virtime.h"
|
#include "virtime.h"
|
||||||
|
#include "locking/domain_lock.h"
|
||||||
|
|
||||||
#define VIR_FROM_THIS VIR_FROM_QEMU
|
#define VIR_FROM_THIS VIR_FROM_QEMU
|
||||||
|
|
||||||
@ -139,17 +140,19 @@ qemuBlockJobEventProcess(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX We want to revoke security labels and disk
|
/* XXX We want to revoke security labels as well as audit that
|
||||||
* lease, as well as audit that revocation, before
|
* revocation, before dropping the original source. But it gets
|
||||||
* dropping the original source. But it gets tricky
|
* tricky if both source and mirror share common backing files (we
|
||||||
* if both source and mirror share common backing
|
* want to only revoke the non-shared portion of the chain); so for
|
||||||
* files (we want to only revoke the non-shared
|
* now, we leak the access to the original. */
|
||||||
* portion of the chain); so for now, we leak the
|
virDomainLockImageDetach(driver->lockManager, vm, disk->src);
|
||||||
* access to the original. */
|
|
||||||
virStorageSourceFree(disk->src);
|
virStorageSourceFree(disk->src);
|
||||||
disk->src = disk->mirror;
|
disk->src = disk->mirror;
|
||||||
} else {
|
} else {
|
||||||
virStorageSourceFree(disk->mirror);
|
if (disk->mirror) {
|
||||||
|
virDomainLockImageDetach(driver->lockManager, vm, disk->mirror);
|
||||||
|
virStorageSourceFree(disk->mirror);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Recompute the cached backing chain to match our
|
/* 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_FAILED:
|
||||||
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
|
case VIR_DOMAIN_BLOCK_JOB_CANCELED:
|
||||||
virStorageSourceFree(disk->mirror);
|
if (disk->mirror) {
|
||||||
disk->mirror = NULL;
|
virDomainLockImageDetach(driver->lockManager, vm, disk->mirror);
|
||||||
|
virStorageSourceFree(disk->mirror);
|
||||||
|
disk->mirror = NULL;
|
||||||
|
}
|
||||||
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
|
disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_NONE;
|
||||||
disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
|
disk->mirrorJob = VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN;
|
||||||
save = true;
|
save = true;
|
||||||
|
@ -16244,9 +16244,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
if (disk->mirror->format &&
|
if (disk->mirror->format &&
|
||||||
disk->mirror->format != VIR_STORAGE_FILE_RAW &&
|
disk->mirror->format != VIR_STORAGE_FILE_RAW &&
|
||||||
(virDomainLockDiskAttach(driver->lockManager, cfg->uri, vm,
|
(qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0 ||
|
||||||
disk) < 0 ||
|
|
||||||
qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0 ||
|
|
||||||
qemuSetupDiskCgroup(vm, disk) < 0 ||
|
qemuSetupDiskCgroup(vm, disk) < 0 ||
|
||||||
qemuSecuritySetDiskLabel(driver, vm, disk) < 0))
|
qemuSecuritySetDiskLabel(driver, vm, disk) < 0))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
Reference in New Issue
Block a user