qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org, mreitz@redhat.com,
	kwolf@redhat.com, armbru@redhat.com, eblake@redhat.com,
	lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 1/2] qmp: forbid qmp_cont in RUN_STATE_FINISH_MIGRATE
Date: Thu, 24 Jan 2019 13:38:37 +0000	[thread overview]
Message-ID: <20190124133837.GD2101@work-vm> (raw)
In-Reply-To: <20190124122525.145968-2-vsementsov@virtuozzo.com>

* Vladimir Sementsov-Ogievskiy (vsementsov@virtuozzo.com) wrote:
> qmp_cont in RUN_STATE_FINISH_MIGRATE may lead to moving vm to
> RUN_STATE_RUNNING, before actual migration finish. So, when migration
> thread will try to go to RUN_STATE_POSTMIGRATE, assuming transition
> RUN_STATE_FINISH_MIGRATE->RUN_STATE_POSTMIGRATE, it will crash, as
> current state is RUN_STATE_RUNNING, and transition
> RUN_STATE_RUNNING->RUN_STATE_POSTMIGRATE is forbidden.
> 
> Reported-by: Max Reitz <mreitz@redhat.com>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  qmp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/qmp.c b/qmp.c
> index 4c819dd8cf..c2ecf1d804 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -156,6 +156,9 @@ void qmp_cont(Error **errp)
>          return;
>      } else if (runstate_check(RUN_STATE_SUSPENDED)) {
>          return;
> +    } else if (runstate_check(RUN_STATE_FINISH_MIGRATE)) {
> +        error_setg(errp, "Migration is not finalized yet");
> +        return;
>      }

Yeh, a bit of a hack, but I think that's as best as we can do for now;
we can't ban all cont's during migration.

Note, it's still racy since you could call this partway through the
completion before it's set to finish.


Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>


>      for (blk = blk_next(NULL); blk; blk = blk_next(blk)) {
> -- 
> 2.18.0
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2019-01-24 13:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24 12:25 [Qemu-devel] [PATCH 0/2] fix qmp-cont vs migration-finish race-crash Vladimir Sementsov-Ogievskiy
2019-01-24 12:25 ` [Qemu-devel] [PATCH 1/2] qmp: forbid qmp_cont in RUN_STATE_FINISH_MIGRATE Vladimir Sementsov-Ogievskiy
2019-01-24 13:38   ` Dr. David Alan Gilbert [this message]
2019-01-24 12:25 ` [Qemu-devel] [PATCH 2/2] iotest: fix 169: do not run " Vladimir Sementsov-Ogievskiy
2019-01-24 14:10   ` Vladimir Sementsov-Ogievskiy
2019-01-25 16:25   ` Max Reitz
2019-05-08 15:21 ` [Qemu-devel] [PATCH 0/2] fix qmp-cont vs migration-finish race-crash Thomas Huth
2019-05-14 16:20   ` Dr. David Alan Gilbert
2019-05-15  8:07 ` Kevin Wolf

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=20190124133837.GD2101@work-vm \
    --to=dgilbert@redhat.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.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).