From: Jeff Cody <jcody@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
pbonzini@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] mirror: Quiesce source during "mirror_exit"
Date: Wed, 2 Dec 2015 09:20:48 -0500 [thread overview]
Message-ID: <20151202142048.GE2645@localhost.localdomain> (raw)
In-Reply-To: <1448245684-13918-1-git-send-email-famz@redhat.com>
On Mon, Nov 23, 2015 at 10:28:04AM +0800, Fam Zheng wrote:
> 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>
> ---
> block/mirror.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index 52c9abf..0e8f556 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);
> }
>
> --
> 2.4.3
>
Thanks, applied to my block branch:
git://github.com/codyprime/qemu-kvm-jtc.git block
prev parent reply other threads:[~2015-12-02 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-23 2:28 [Qemu-devel] [PATCH] mirror: Quiesce source during "mirror_exit" Fam Zheng
2015-12-02 14:20 ` Jeff Cody [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151202142048.GE2645@localhost.localdomain \
--to=jcody@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).