From: Markus Armbruster Date: Mon, 13 May 2024 14:16:58 +0000 (+0200) Subject: block: Improve error message when external snapshot can't flush X-Git-Tag: qemu-xen-4.20.0~134^2~8 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=540d91b40c390faa565e613a85bc0950ca7e0775;p=qemu-xen.git block: Improve error message when external snapshot can't flush external_snapshot_action() reports bdrv_flush() failure to its caller as An IO error has occurred The errno code returned by bdrv_flush() is lost. Improve this to Write to node '' failed: Signed-off-by: Markus Armbruster Message-ID: <20240513141703.549874-2-armbru@redhat.com> Reviewed-by: Philippe Mathieu-Daudé --- diff --git a/blockdev.c b/blockdev.c index 08eccc9052..528db3452f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1406,8 +1406,10 @@ static void external_snapshot_action(TransactionAction *action, } if (!bdrv_is_read_only(state->old_bs)) { - if (bdrv_flush(state->old_bs)) { - error_setg(errp, QERR_IO_ERROR); + ret = bdrv_flush(state->old_bs); + if (ret < 0) { + error_setg_errno(errp, -ret, "Write to node '%s' failed", + bdrv_get_device_or_node_name(state->old_bs)); return; } }