All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wen Congyang <wencongyang@gmail.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: Sat, 8 Oct 2016 22:58:38 +0800	[thread overview]
Message-ID: <57F9099E.9040703@gmail.com> (raw)
In-Reply-To: <1475842893-11763-1-git-send-email-pbonzini@redhat.com>

At 2016/10/7 20:21, 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>

This patch looks fine to me.
Reviewed-by: Wen Congyang <wency@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);
>

  reply	other threads:[~2016-10-08 14:58 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 [this message]
2016-10-12  5:02 ` Changlong Xie
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=57F9099E.9040703@gmail.com \
    --to=wencongyang@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.