All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Longpeng(Mike)" <longpeng2@huawei.com>
Cc: arei.gonglei@huawei.com, huangzhichao@huawei.com,
	qemu-devel@nongnu.org, quintela@redhat.com
Subject: Re: [PATCH] migration: handle CANCELLING state in migration_completion()
Date: Thu, 12 Nov 2020 15:30:58 +0000	[thread overview]
Message-ID: <20201112153058.GF13424@work-vm> (raw)
In-Reply-To: <20201105091726.148-1-longpeng2@huawei.com>

* Longpeng(Mike) (longpeng2@huawei.com) wrote:
> The following sequence may cause the VM abort during migration:
> 
> 1. RUN_STATE_RUNNING,MIGRATION_STATUS_ACTIVE
> 
> 2. before call migration_completion(), we send migrate_cancel
>    QMP command, the state machine is changed to:
>      RUN_STATE_RUNNING,MIGRATION_STATUS_CANCELLING
> 
> 3. call migration_completion(), and the state machine is
>    switch to: RUN_STATE_RUNNING,MIGRATION_STATUS_COMPLETED
> 
> 4. call migration_iteration_finish(), because the migration
>    status is COMPLETED, so it will try to set the runstate
>    to POSTMIGRATE, but RUNNING-->POSTMIGRATE is an invalid
>    transition, so abort().
> 
> The migration_completion() should not change the migration state
> to COMPLETED if it is already changed to CANCELLING.
> 
> Signed-off-by: Longpeng(Mike) <longpeng2@huawei.com>

Queued

> ---
>  migration/migration.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/migration/migration.c b/migration/migration.c
> index 3263aa5..b11a2bd 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -3061,6 +3061,8 @@ static void migration_completion(MigrationState *s)
>  
>          qemu_savevm_state_complete_postcopy(s->to_dst_file);
>          trace_migration_completion_postcopy_end_after_complete();
> +    } else if (s->state == MIGRATION_STATUS_CANCELLING) {
> +        goto fail;
>      }
>  
>      /*
> -- 
> 1.8.3.1
> 
> 
-- 
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK



      parent reply	other threads:[~2020-11-12 15:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05  9:17 [PATCH] migration: handle CANCELLING state in migration_completion() Longpeng(Mike)
2020-11-12 10:38 ` Dr. David Alan Gilbert
2020-11-12 15:30 ` Dr. David Alan Gilbert [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=20201112153058.GF13424@work-vm \
    --to=dgilbert@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=huangzhichao@huawei.com \
    --cc=longpeng2@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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.