]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
block/export: Don't ignore image activation error in blk_exp_add()
authorKevin Wolf <kwolf@redhat.com>
Tue, 4 Feb 2025 21:14:01 +0000 (22:14 +0100)
committerKevin Wolf <kwolf@redhat.com>
Thu, 6 Feb 2025 13:26:51 +0000 (14:26 +0100)
Currently, block exports can't handle inactive images correctly.
Incoming write requests would run into assertion failures. Make sure
that we return an error when creating an export can't activate the
image.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20250204211407.381505-11-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/export/export.c

index 79c71ee245660f44ac510bc346d4fe2ec8b4d4d7..bac42b86082d18127fe5d29acf12efb28877567a 100644 (file)
@@ -145,7 +145,11 @@ BlockExport *blk_exp_add(BlockExportOptions *export, Error **errp)
      * ctx was acquired in the caller.
      */
     bdrv_graph_rdlock_main_loop();
-    bdrv_activate(bs, NULL);
+    ret = bdrv_activate(bs, errp);
+    if (ret < 0) {
+        bdrv_graph_rdunlock_main_loop();
+        goto fail;
+    }
     bdrv_graph_rdunlock_main_loop();
 
     perm = BLK_PERM_CONSISTENT_READ;