On Thu, Jan 25, 2024 at 14:52:10 -0600, Jonathon Jongsma wrote: > 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. qemuNbdkitStartStorageSource is called from: src/qemu/qemu_extdevice.c=qemuExtDevicesStart(virQEMUDriver *driver, src/qemu/qemu_extdevice.c: if (qemuNbdkitStartStorageSource(driver, vm, disk->src, true) < 0) src/qemu/qemu_extdevice.c: if (qemuNbdkitStartStorageSource(driver, vm, def->os.loader->nvram, true) < 0) The counterpart is qemuExtDevicesStop. src/qemu/qemu_hotplug.c=qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver, src/qemu/qemu_hotplug.c: if (qemuNbdkitStartStorageSource(driver, vm, disk->src, true) < 0) This has cleanup inline. Thus I don't see a possibility where what you describe in the commit message can happen. > > Signed-off-by: Jonathon Jongsma <jjongsma@xxxxxxxxxx> > --- > src/qemu/qemu_nbdkit.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c > index 39f9c58a48..edbe2137d0 100644 > --- a/src/qemu/qemu_nbdkit.c > +++ b/src/qemu/qemu_nbdkit.c > @@ -920,8 +920,11 @@ qemuNbdkitStartStorageSource(virQEMUDriver *driver, > return qemuNbdkitStartStorageSourceOne(driver, vm, src); > > 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, true); > return -1; > + } > } > > return 0; > -- > 2.43.0 > _______________________________________________ > Devel mailing list -- devel@xxxxxxxxxxxxxxxxx > To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx _______________________________________________ Devel mailing list -- devel@xxxxxxxxxxxxxxxxx To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx