diff options
| author | Fam Zheng | 2015-11-23 03:28:04 +0100 |
|---|---|---|
| committer | Jeff Cody | 2015-12-02 16:44:06 +0100 |
| commit | 176c36997fd4a94a7b919468d8967e0ad81fdf9c (patch) | |
| tree | dc9869b8486c34bb076523735178bec2e4d8bd1a /block | |
| parent | Merge remote-tracking branch 'remotes/rth/tags/pull-tcg-20151201' into staging (diff) | |
| download | qemu-176c36997fd4a94a7b919468d8967e0ad81fdf9c.tar.gz qemu-176c36997fd4a94a7b919468d8967e0ad81fdf9c.tar.xz qemu-176c36997fd4a94a7b919468d8967e0ad81fdf9c.zip | |
mirror: Quiesce source during "mirror_exit"
With dataplane, the ioeventfd events could be dispatched after
mirror_run releases the dirty bitmap, but before mirror_exit actually
does the device switch, because the iothread will still be running, and
it will cause silent data loss.
Fix this by adding a bdrv_drained_begin/end pair around the window, so
that no new external request will be handled.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Jeff Cody <jcody@redhat.com>
Diffstat (limited to 'block')
| -rw-r--r-- | block/mirror.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/block/mirror.c b/block/mirror.c index 52c9abfe14..0e8f5565a5 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -388,6 +388,7 @@ static void mirror_exit(BlockJob *job, void *opaque) bdrv_unref(s->target); block_job_completed(&s->common, data->ret); g_free(data); + bdrv_drained_end(src); bdrv_unref(src); } @@ -607,6 +608,9 @@ immediate_exit: data = g_malloc(sizeof(*data)); data->ret = ret; + /* Before we switch to target in mirror_exit, make sure data doesn't + * change. */ + bdrv_drained_begin(s->common.bs); block_job_defer_to_main_loop(&s->common, mirror_exit, data); } |
