* [Qemu-devel] [patch] avoid a bogus COMPLETED->CANCELLED transition
@ 2013-11-07 8:21 Zhanghaoyu (A)
2013-11-07 9:54 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: Zhanghaoyu (A) @ 2013-11-07 8:21 UTC (permalink / raw)
To: qemu-devel@nongnu.org, Paolo Bonzini, Michael S. Tsirkin,
Marcelo Tosatti, Eric Blake, Gleb Natapov
Cc: Huangweidong (C), Zhanghaoyu (A), Luonengjun, Zengjunliang,
Wangrui (K)
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)
--
1.7.3.1.msysgit.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [patch] avoid a bogus COMPLETED->CANCELLED transition
2013-11-07 8:21 [Qemu-devel] [patch] avoid a bogus COMPLETED->CANCELLED transition Zhanghaoyu (A)
@ 2013-11-07 9:54 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2013-11-07 9:54 UTC (permalink / raw)
To: Zhanghaoyu (A)
Cc: Huangweidong (C), Gleb Natapov, Michael S. Tsirkin,
Marcelo Tosatti, Luonengjun, qemu-devel@nongnu.org, Zengjunliang,
Wangrui (K)
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-07 9:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-07 8:21 [Qemu-devel] [patch] avoid a bogus COMPLETED->CANCELLED transition Zhanghaoyu (A)
2013-11-07 9:54 ` Paolo Bonzini
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).