mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
qemu: blockjob: Unplug inherited storage chains when concluding blockjob
In cases when the disk frontend was unplugged while a blockjob was running the blockjob inherits the backing chain. When the blockjob is then terminated we need to unplug the chain as it will not be used any more. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
0a9fd83240
commit
ae4b921f2a
@ -536,6 +536,28 @@ qemuBlockJobEventProcessLegacy(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
qemuBlockJobEventProcessConcludedRemoveChain(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
qemuDomainAsyncJob asyncJob,
|
||||
virStorageSourcePtr chain)
|
||||
{
|
||||
VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
|
||||
|
||||
if (!(data = qemuBlockStorageSourceChainDetachPrepareBlockdev(chain)))
|
||||
return;
|
||||
|
||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||
return;
|
||||
|
||||
qemuBlockStorageSourceChainDetach(qemuDomainGetMonitor(vm), data);
|
||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||
return;
|
||||
|
||||
qemuDomainStorageSourceChainAccessRevoke(driver, vm, chain);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
qemuBlockJobEventProcessConcludedTransition(qemuBlockJobDataPtr job,
|
||||
virQEMUDriverPtr driver,
|
||||
@ -652,6 +674,16 @@ qemuBlockJobEventProcessConcluded(qemuBlockJobDataPtr job,
|
||||
|
||||
qemuBlockJobEventProcessConcludedTransition(job, driver, vm, asyncJob);
|
||||
|
||||
/* unplug the backing chains in case the job inherited them */
|
||||
if (!job->disk) {
|
||||
if (job->chain)
|
||||
qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob,
|
||||
job->chain);
|
||||
if (job->mirrorChain)
|
||||
qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob,
|
||||
job->mirrorChain);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (dismissed) {
|
||||
qemuBlockJobUnregister(job, vm);
|
||||
|
Loading…
x
Reference in New Issue
Block a user