From: Paolo Bonzini <pbonzini@redhat.com>
To: "Zhanghaoyu (A)" <haoyu.zhang@huawei.com>
Cc: "Huangweidong (C)" <weidong.huang@huawei.com>,
Gleb Natapov <gleb@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Luonengjun <luonengjun@huawei.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Zengjunliang <zengjunliang@huawei.com>,
"Wangrui (K)" <moon.wangrui@huawei.com>
Subject: Re: [Qemu-devel] [patch] avoid a bogus COMPLETED->CANCELLED transition
Date: Thu, 07 Nov 2013 10:54:28 +0100 [thread overview]
Message-ID: <527B6354.2060406@redhat.com> (raw)
In-Reply-To: <D3E216785288A145B7BC975F83A2ED1043EF348D@szxeml556-mbx.china.huawei.com>
Il 07/11/2013 09:21, Zhanghaoyu (A) ha scritto:
> Avoid a bogus COMPLETED->CANCELLED transition.
> There is a period of time from the timing of setting COMPLETED state to that of migration thread exits, so during which it's problematic in COMPLETED->CANCELLED transition.
>
> Signed-off-by: Zeng Junliang <zengjunliang@huawei.com>
> Signed-off-by: Zhang Haoyu <haoyu.zhang@huawei.com>
> ---
> migration.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index 2b1ab20..fd73b97 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -326,9 +326,16 @@ void migrate_fd_error(MigrationState *s)
>
> static void migrate_fd_cancel(MigrationState *s)
> {
> + int old_state ;
> DPRINTF("cancelling migration\n");
>
> - migrate_set_state(s, s->state, MIG_STATE_CANCELLED);
> + do {
> + old_state = s->state;
> + if (old_state != MIG_STATE_SETUP && old_state != MIG_STATE_ACTIVE) {
> + break;
> + }
> + migrate_set_state(s, old_state, MIG_STATE_CANCELLED);
> + } while (s->state != MIG_STATE_CANCELLED);
> }
>
> void add_migration_state_change_notifier(Notifier *notify)
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
prev parent reply other threads:[~2013-11-07 9:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-07 8:21 [Qemu-devel] [patch] avoid a bogus COMPLETED->CANCELLED transition Zhanghaoyu (A)
2013-11-07 9:54 ` Paolo Bonzini [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=527B6354.2060406@redhat.com \
--to=pbonzini@redhat.com \
--cc=gleb@redhat.com \
--cc=haoyu.zhang@huawei.com \
--cc=luonengjun@huawei.com \
--cc=moon.wangrui@huawei.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=weidong.huang@huawei.com \
--cc=zengjunliang@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).