From: Kevin Wolf Date: Tue, 4 Feb 2025 21:14:01 +0000 (+0100) Subject: block/export: Don't ignore image activation error in blk_exp_add() X-Git-Tag: v10.0.0-rc0~59^2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69f28176ca0af850db23a1c6364f0c8525b20801;p=thirdparty%2Fqemu.git block/export: Don't ignore image activation error in blk_exp_add() 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 Acked-by: Fabiano Rosas Reviewed-by: Eric Blake Reviewed-by: Stefan Hajnoczi Message-ID: <20250204211407.381505-11-kwolf@redhat.com> Signed-off-by: Kevin Wolf --- diff --git a/block/export/export.c b/block/export/export.c index 79c71ee2456..bac42b86082 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -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;