aboutsummaryrefslogtreecommitdiff
path: root/block/mirror.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-02-20 12:46:42 +0100
committerKevin Wolf <kwolf@redhat.com>2017-02-28 20:47:51 +0100
commitb2c2832c6140cfe3ddc0de2d77eeb0b77dea8fd3 (patch)
treea8887134fb47b8dbd8c23a0cd4da55bc979ecbbb /block/mirror.c
parent12fa4af61fb2a08b156134c3b6717534c637c995 (diff)
downloadqemu-b2c2832c6140cfe3ddc0de2d77eeb0b77dea8fd3.zip
qemu-b2c2832c6140cfe3ddc0de2d77eeb0b77dea8fd3.tar.gz
qemu-b2c2832c6140cfe3ddc0de2d77eeb0b77dea8fd3.tar.bz2
block: Add Error parameter to bdrv_append()
Aborting on error in bdrv_append() isn't correct. This patch fixes it and lets the callers handle failures. Test case 085 needs a reference output update. This is caused by the reversed order of bdrv_set_backing_hd() and change_parent_backing_link() in bdrv_append(): When the backing file of the new node is set, the parent nodes are still pointing to the old top, so the backing blocker is now initialised with the node name rather than the BlockBackend name. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/mirror.c')
-rw-r--r--block/mirror.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/block/mirror.c b/block/mirror.c
index 8497e0d..57f26c3 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -1099,6 +1099,7 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
BlockDriverState *mirror_top_bs;
bool target_graph_mod;
bool target_is_backing;
+ Error *local_err = NULL;
int ret;
if (granularity == 0) {
@@ -1130,9 +1131,15 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
* it alive until block_job_create() even if bs has no parent. */
bdrv_ref(mirror_top_bs);
bdrv_drained_begin(bs);
- bdrv_append(mirror_top_bs, bs);
+ bdrv_append(mirror_top_bs, bs, &local_err);
bdrv_drained_end(bs);
+ if (local_err) {
+ bdrv_unref(mirror_top_bs);
+ error_propagate(errp, local_err);
+ return;
+ }
+
/* Make sure that the source is not resized while the job is running */
s = block_job_create(job_id, driver, mirror_top_bs,
BLK_PERM_CONSISTENT_READ,