When starting nbdkit processes for the backing store of a disk, we were
returning an error if any backing store failed, but we were not cleaning
up processes that succeeded higher in the chain. Make sure that if we
return a failure status from qemuNbdkitStartStorageSource() that we roll
back any processes that had been started.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
virStorageSource *backing;
for (backing = src; backing != NULL; backing = backing->backingStore) {
- if (qemuNbdkitStartStorageSourceOne(driver, vm, backing) < 0)
+ if (qemuNbdkitStartStorageSourceOne(driver, vm, backing) < 0) {
+ /* roll back any previously-started sources */
+ qemuNbdkitStopStorageSource(src, vm, chain);
return -1;
+ }
if (!chain)
break;
}