summaryrefslogtreecommitdiff
path: root/block/mirror.c
diff options
context:
space:
mode:
authorAlberto Garcia <berto@igalia.com>2019-03-12 18:48:42 +0200
committerKevin Wolf <kwolf@redhat.com>2019-03-12 20:30:14 +0100
commitef53dc09ed6aacca12aeb204258779273ba513ca (patch)
treea4915628040d0b5e79b9dcc6e0659de2d4ff5846 /block/mirror.c
parentdf827336abd072cf71aa6990a12ce13187b22861 (diff)
downloadqemu-ef53dc09ed6aacca12aeb204258779273ba513ca.zip
block: Freeze the backing chain for the duration of the mirror job
Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/mirror.c')
-rw-r--r--block/mirror.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/block/mirror.c b/block/mirror.c
index 726d3c27fb..010fdafd79 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -630,6 +630,10 @@ static int mirror_exit_common(Job *job)
}
s->prepared = true;
+ if (bdrv_chain_contains(src, target_bs)) {
+ bdrv_unfreeze_backing_chain(mirror_top_bs, target_bs);
+ }
+
bdrv_release_dirty_bitmap(src, s->dirty_bitmap);
/* Make sure that the source BDS doesn't go away during bdrv_replace_node,
@@ -1639,6 +1643,10 @@ static void mirror_start_job(const char *job_id, BlockDriverState *bs,
goto fail;
}
}
+
+ if (bdrv_freeze_backing_chain(mirror_top_bs, target, errp) < 0) {
+ goto fail;
+ }
}
QTAILQ_INIT(&s->ops_in_flight);