aboutsummaryrefslogtreecommitdiff
path: root/block/mirror.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2017-02-17 20:42:32 +0100
committerKevin Wolf <kwolf@redhat.com>2017-02-28 20:47:51 +0100
commit12fa4af61fb2a08b156134c3b6717534c637c995 (patch)
treebd93d226c7af3454aa64b64bdb771b8fc5d22083 /block/mirror.c
parentc8f6d58edb0defbe1e90d44419ec8ec6d711c341 (diff)
downloadqemu-12fa4af61fb2a08b156134c3b6717534c637c995.zip
qemu-12fa4af61fb2a08b156134c3b6717534c637c995.tar.gz
qemu-12fa4af61fb2a08b156134c3b6717534c637c995.tar.bz2
block: Add Error parameter to bdrv_set_backing_hd()
Not all callers of bdrv_set_backing_hd() know for sure that attaching the backing file will be allowed by the permission system. Return the error from the function rather than aborting. 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.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/mirror.c b/block/mirror.c
index 869212d..8497e0d 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -503,6 +503,7 @@ static void mirror_exit(BlockJob *job, void *opaque)
BlockDriverState *src = s->source;
BlockDriverState *target_bs = blk_bs(s->target);
BlockDriverState *mirror_top_bs = s->mirror_top_bs;
+ Error *local_err = NULL;
/* Make sure that the source BDS doesn't go away before we called
* block_job_completed(). */
@@ -516,7 +517,11 @@ static void mirror_exit(BlockJob *job, void *opaque)
if (s->backing_mode == MIRROR_SOURCE_BACKING_CHAIN) {
BlockDriverState *backing = s->is_none_mode ? src : s->base;
if (backing_bs(target_bs) != backing) {
- bdrv_set_backing_hd(target_bs, backing);
+ bdrv_set_backing_hd(target_bs, backing, &local_err);
+ if (local_err) {
+ error_report_err(local_err);
+ data->ret = -EPERM;
+ }
}
}