aboutsummaryrefslogtreecommitdiff
path: root/block/commit.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/commit.c
parentc8f6d58edb0defbe1e90d44419ec8ec6d711c341 (diff)
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/commit.c')
-rw-r--r--block/commit.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/block/commit.c b/block/commit.c
index 1e0f5318a4..22a0a4db98 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -121,7 +121,7 @@ static void commit_complete(BlockJob *job, void *opaque)
* filter driver from the backing chain. Do this as the final step so that
* the 'consistent read' permission can be granted. */
if (remove_commit_top_bs) {
- bdrv_set_backing_hd(overlay_bs, top);
+ bdrv_set_backing_hd(overlay_bs, top, &error_abort);
}
}
@@ -316,8 +316,8 @@ void commit_start(const char *job_id, BlockDriverState *bs,
goto fail;
}
- bdrv_set_backing_hd(commit_top_bs, top);
- bdrv_set_backing_hd(overlay_bs, commit_top_bs);
+ bdrv_set_backing_hd(commit_top_bs, top, &error_abort);
+ bdrv_set_backing_hd(overlay_bs, commit_top_bs, &error_abort);
s->commit_top_bs = commit_top_bs;
bdrv_unref(commit_top_bs);
@@ -390,7 +390,7 @@ fail:
blk_unref(s->top);
}
if (commit_top_bs) {
- bdrv_set_backing_hd(overlay_bs, top);
+ bdrv_set_backing_hd(overlay_bs, top, &error_abort);
}
block_job_unref(&s->common);
}
@@ -451,8 +451,8 @@ int bdrv_commit(BlockDriverState *bs)
goto ro_cleanup;
}
- bdrv_set_backing_hd(commit_top_bs, backing_file_bs);
- bdrv_set_backing_hd(bs, commit_top_bs);
+ bdrv_set_backing_hd(commit_top_bs, backing_file_bs, &error_abort);
+ bdrv_set_backing_hd(bs, commit_top_bs, &error_abort);
ret = blk_insert_bs(backing, backing_file_bs, &local_err);
if (ret < 0) {
@@ -532,7 +532,7 @@ ro_cleanup:
blk_unref(backing);
if (backing_file_bs) {
- bdrv_set_backing_hd(bs, backing_file_bs);
+ bdrv_set_backing_hd(bs, backing_file_bs, &error_abort);
}
bdrv_unref(commit_top_bs);
blk_unref(src);