From nobody Sat Feb 7 09:42:19 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1607327227; cv=none; d=zohomail.com; s=zohoarc; b=fUNQ55FxIjC5w9faL7xNNaeEvtTqDWxUczvtshE1wqUPfxnD3sP9YeHF6qSkyJeMhgMuje314TwpXH2XzisFH8h9QyKgqG3Dvhe5IjcE1k+q007ES9Ka3xGlWQ/AAk5hW54wEL70fKPHvnA8f5g3tvuqwbgu+qN7/2APIFYoE0g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607327227; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=mKzwz4ppgbltxnzh0m5zIO2RoXA2PexGJ84R2/W9D80=; b=iIT9cPGxXimfYE4f38sImaoDtRWBGNgvBrjJZ+jyn8dqSWl3p+OnQJfDD92NP/8ONLi4nIPUdYE/TblNq8cZVIC+38MFYmxzs85Jn5NTtgEaC7d7AD04gfGYpM7CB1vVQXZnUUPvmU+lfUEAOwsU/Ka6qaqhTinPka6ZfhkkcuM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1607327227207909.6132171625512; Sun, 6 Dec 2020 23:47:07 -0800 (PST) Received: from localhost ([::1]:44876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmBEg-0000a6-5A for importer@patchew.org; Mon, 07 Dec 2020 02:47:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmBCc-0007Wp-37 for qemu-devel@nongnu.org; Mon, 07 Dec 2020 02:44:59 -0500 Received: from smtp.h3c.com ([60.191.123.56]:39463 helo=h3cspam01-ex.h3c.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmBCT-00005H-BW for qemu-devel@nongnu.org; Mon, 07 Dec 2020 02:44:57 -0500 Received: from DAG2EX09-IDC.srv.huawei-3com.com ([10.8.0.72]) by h3cspam01-ex.h3c.com with ESMTP id 0B77iFdv073332; Mon, 7 Dec 2020 15:44:15 +0800 (GMT-8) (envelope-from tu.guoyi@h3c.com) Received: from DAG2EX03-BASE.srv.huawei-3com.com (10.8.0.66) by DAG2EX09-IDC.srv.huawei-3com.com (10.8.0.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 7 Dec 2020 15:44:18 +0800 Received: from DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074]) by DAG2EX03-BASE.srv.huawei-3com.com ([fe80::5d18:e01c:bbbd:c074%7]) with mapi id 15.01.2106.002; Mon, 7 Dec 2020 15:44:18 +0800 From: Tuguoyi To: Juan Quintela , "Dr. David Alan Gilbert" Subject: [PATCH v2] migration: Don't allow migration if vm is in POSTMIGRATE state Thread-Topic: [PATCH v2] migration: Don't allow migration if vm is in POSTMIGRATE state Thread-Index: AdbMarpfqkzuH/ZkR9WAT/cFh1Bw2Q== Date: Mon, 7 Dec 2020 07:44:18 +0000 Message-ID: Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.125.108.131] x-sender-location: DAG2 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-DNSRBL: X-MAIL: h3cspam01-ex.h3c.com 0B77iFdv073332 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=60.191.123.56; envelope-from=tu.guoyi@h3c.com; helo=h3cspam01-ex.h3c.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "vsementsov@virtuozzo.com" , "qemu-devel@nongnu.org" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" 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=3D0x55ca90c80400) 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=3Dtrue, in_postcopy=3Dfalse, f=3D0x55ca907044b0) at /build/qemu-5.0/migration/savevm.c:1401 #7 qemu_savevm_state_complete_precopy (f=3D0x55ca907044b0, iterable_only= =3Diterable_only@entry=3Dfalse, inactivate_disks=3Dinactivate_disks@entry= =3Dtrue) at /build/qemu-5.0/migration/savevm.c:1453 #8 0x000055ca8de4f581 in migration_completion (s=3D0x55ca8f64d9f0) at /bui= ld/qemu-5.0/migration/migration.c:2941 #9 migration_iteration_run (s=3D0x55ca8f64d9f0) at /build/qemu-5.0/migrati= on/migration.c:3295 #10 migration_thread (opaque=3Dopaque@entry=3D0x55ca8f64d9f0) at /build/qem= u-5.0/migration/migration.c:3459 #11 0x000055ca8dfc6716 in qemu_thread_start (args=3D) at /bu= ild/qemu-5.0/util/qemu-thread-posix.c:519 #12 0x00007fbf95c5f184 in start_thread () from /lib/x86_64-linux-gnu/libpth= read.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 just make migration job error-out with a message in migrate_fd_connect() if the vm is in RUN_STATE_POSTMIGRATE stat= e. Signed-off-by: Tuguoyi --- migration/migration.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/migration/migration.c b/migration/migration.c index 87a9b59..4091678 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -3622,6 +3622,13 @@ void migrate_fd_connect(MigrationState *s, Error *er= ror_in) return; } =20 + if (runstate_check(RUN_STATE_POSTMIGRATE)) { + error_report("Can't migrate the vm that is in POSTMIGRATE state"); + migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED); + migrate_fd_cleanup(s); + return; + } + if (resume) { /* This is a resumed migration */ rate_limit =3D s->parameters.max_postcopy_bandwidth / --=20 2.7.4 [Patch v1]: https://lists.gnu.org/archive/html/qemu-devel/2020-11/msg05950.= html