From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Cc: arei.gonglei@huawei.com, stefanha@redhat.com,
zhang.zhanghailiang@huawei.com
Subject: Re: [Qemu-devel] [PATCH] replication: interrupt failover if the main device is closed
Date: Wed, 12 Oct 2016 13:02:51 +0800 [thread overview]
Message-ID: <57FDC3FB.30500@cn.fujitsu.com> (raw)
In-Reply-To: <1475842893-11763-1-git-send-email-pbonzini@redhat.com>
On 10/07/2016 08:21 PM, Paolo Bonzini wrote:
> Without this change, there is a race condition in tests/test-replication.
> Depending on how fast the failover job (active commit) runs, there is a
> chance of two bad things happening:
>
> 1) replication_done can be called after the secondary has been closed
> and hence when the BDRVReplicationState is not valid anymore.
>
> 2) two copies of the active disk are present during the
> /replication/secondary/stop test (that test runs immediately after
> /replication/secondary/start, which tests failover). This causes the
> corruption detector to fire.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
> block/replication.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/block/replication.c b/block/replication.c
> index 3bd1cf1..5231a00 100644
> --- a/block/replication.c
> +++ b/block/replication.c
> @@ -133,6 +133,9 @@ static void replication_close(BlockDriverState *bs)
> if (s->replication_state == BLOCK_REPLICATION_RUNNING) {
> replication_stop(s->rs, false, NULL);
> }
> + if (s->replication_state == BLOCK_REPLICATION_FAILOVER) {
> + block_job_cancel_sync(s->active_disk->bs->job);
> + }
>
> if (s->mode == REPLICATION_MODE_SECONDARY) {
> g_free(s->top_id);
>
next prev parent reply other threads:[~2016-10-12 4:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-07 12:21 [Qemu-devel] [PATCH] replication: interrupt failover if the main device is closed Paolo Bonzini
2016-10-08 14:58 ` Wen Congyang
2016-10-12 5:02 ` Changlong Xie [this message]
2016-10-14 15:22 ` Stefan Hajnoczi
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=57FDC3FB.30500@cn.fujitsu.com \
--to=xiecl.fnst@cn.fujitsu.com \
--cc=arei.gonglei@huawei.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=zhang.zhanghailiang@huawei.com \
/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).