aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2021-04-09 14:04:18 +0200
committerKevin Wolf <kwolf@redhat.com>2021-04-09 18:00:29 +0200
commitc41f5b96ee73925c165036d59c4efa761826e800 (patch)
tree4e4cdbe0f0999a9834f39264f6d5f9819d62ee98
parentda64789d3a16b2c5b5f1be9c75b00c2b8ae393a0 (diff)
downloadqemu-arm-c41f5b96ee73925c165036d59c4efa761826e800.tar.gz
mirror: Move open_backing_file to exit_common
This is a graph change and therefore should be done in job-finalize (which is what invokes mirror_exit_common()). Signed-off-by: Max Reitz <mreitz@redhat.com> Message-Id: <20210409120422.144040-2-mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/mirror.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/block/mirror.c b/block/mirror.c
index d7e54c0ff7..f1f936bf1a 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -689,6 +689,14 @@ static int mirror_exit_common(Job *job)
ret = -EPERM;
}
}
+ } else if (!abort && s->backing_mode == MIRROR_OPEN_BACKING_CHAIN) {
+ assert(!bdrv_backing_chain_next(target_bs));
+ ret = bdrv_open_backing_file(bdrv_skip_filters(target_bs), NULL,
+ "backing", &local_err);
+ if (ret < 0) {
+ error_report_err(local_err);
+ local_err = NULL;
+ }
}
if (s->to_replace) {
@@ -1107,9 +1115,6 @@ immediate_exit:
static void mirror_complete(Job *job, Error **errp)
{
MirrorBlockJob *s = container_of(job, MirrorBlockJob, common.job);
- BlockDriverState *target;
-
- target = blk_bs(s->target);
if (!s->synced) {
error_setg(errp, "The active block job '%s' cannot be completed",
@@ -1117,17 +1122,6 @@ static void mirror_complete(Job *job, Error **errp)
return;
}
- if (s->backing_mode == MIRROR_OPEN_BACKING_CHAIN) {
- int ret;
-
- assert(!bdrv_backing_chain_next(target));
- ret = bdrv_open_backing_file(bdrv_skip_filters(target), NULL,
- "backing", errp);
- if (ret < 0) {
- return;
- }
- }
-
/* block all operations on to_replace bs */
if (s->replaces) {
AioContext *replace_aio_context;