[PATCH 2/3] qemu: roll back if not all nbdkit backends are successful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux