From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Tuguoyi <tu.guoyi@h3c.com>
Cc: kwolf@redhat.com,
"vsementsov@virtuozzo.com" <vsementsov@virtuozzo.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Juan Quintela <quintela@redhat.com>
Subject: Re: [PATCH v3] migration: Don't allow migration if vm is in POSTMIGRATE
Date: Thu, 17 Dec 2020 18:22:49 +0000 [thread overview]
Message-ID: <20201217182249.GO4117@work-vm> (raw)
In-Reply-To: <6b704294ad2e405781c38fb38d68c744@h3c.com>
* Tuguoyi (tu.guoyi@h3c.com) wrote:
> The following steps will cause qemu assertion failure:
> - pause vm by executing 'virsh suspend'
> - create external snapshot of memory and disk using 'virsh snapshot-create-as'
> - doing the above operation again will cause qemu crash
>
> The backtrace looks like:
> #0 0x00007fbf958c5c37 in raise () from /lib/x86_64-linux-gnu/libc.so.6
> #1 0x00007fbf958c9028 in abort () from /lib/x86_64-linux-gnu/libc.so.6
> #2 0x00007fbf958bebf6 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
> #3 0x00007fbf958beca2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
> #4 0x000055ca8decd39d in bdrv_inactivate_recurse (bs=0x55ca90c80400) at /build/qemu-5.0/block.c:5724
> #5 0x000055ca8dece967 in bdrv_inactivate_all () at /build//qemu-5.0/block.c:5792
> #6 0x000055ca8de5539d in qemu_savevm_state_complete_precopy_non_iterable (inactivate_disks=true, in_postcopy=false, f=0x55ca907044b0)
> at /build/qemu-5.0/migration/savevm.c:1401
> #7 qemu_savevm_state_complete_precopy (f=0x55ca907044b0, iterable_only=iterable_only@entry=false, inactivate_disks=inactivate_disks@entry=true)
> at /build/qemu-5.0/migration/savevm.c:1453
> #8 0x000055ca8de4f581 in migration_completion (s=0x55ca8f64d9f0) at /build/qemu-5.0/migration/migration.c:2941
> #9 migration_iteration_run (s=0x55ca8f64d9f0) at /build/qemu-5.0/migration/migration.c:3295
> #10 migration_thread (opaque=opaque@entry=0x55ca8f64d9f0) at /build/qemu-5.0/migration/migration.c:3459
> #11 0x000055ca8dfc6716 in qemu_thread_start (args=<optimized out>) at /build/qemu-5.0/util/qemu-thread-posix.c:519
> #12 0x00007fbf95c5f184 in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
> #13 0x00007fbf9598cbed in clone () from /lib/x86_64-linux-gnu/libc.so.6
>
> When the first migration completes, bs->open_flags will set BDRV_O_INACTIVE
> flag by bdrv_inactivate_all(), and during the second migration the
> bdrv_inactivate_recurse assert that the bs->open_flags is already
> BDRV_O_INACTIVE enabled which cause crash.
>
> As Vladimir suggested, this patch makes migrate_prepare check the state of vm and
> return error if it is in RUN_STATE_POSTMIGRATE state.
>
> Signed-off-by: Tuguoyi <tu.guoyi@h3c.com>
Yes, we've had this problem for a long long time; there are a bunch of
other similar conditions; the real answer is to figure out some command
for explicitly handing back control of the block devices (without
actually restarting the CPUs).
However, this is a reasonable patch to cover the common case.
Queued
> ---
> migration/migration.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/migration/migration.c b/migration/migration.c
> index 87a9b59..5e33962 100644
> --- a/migration/migration.c
> +++ b/migration/migration.c
> @@ -2115,6 +2115,12 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
> return false;
> }
>
> + if (runstate_check(RUN_STATE_POSTMIGRATE)) {
> + error_setg(errp, "Can't migrate the vm that was paused due to "
> + "previous migration");
> + return false;
> + }
> +
> if (migration_is_blocked(errp)) {
> return false;
> }
> --
> 2.7.4
>
> [Patch v2]: https://lists.gnu.org/archive/html/qemu-devel/2020-12/msg01318.html
> [Patch v1]: https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg05950.html
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
prev parent reply other threads:[~2020-12-17 18:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-08 1:46 [PATCH v3] migration: Don't allow migration if vm is in POSTMIGRATE Tuguoyi
2020-12-08 5:14 ` Vladimir Sementsov-Ogievskiy
2020-12-09 14:20 ` Pankaj Gupta
2020-12-17 7:29 ` Tuguoyi
2020-12-17 18:22 ` 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=20201217182249.GO4117@work-vm \
--to=dgilbert@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=tu.guoyi@h3c.com \
--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).