From patchwork Fri Nov 20 09:34:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wen Congyang X-Patchwork-Id: 546858 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 090AF140DA3 for ; Fri, 20 Nov 2015 20:36:18 +1100 (AEDT) Received: from localhost ([::1]:46190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzi75-0001dm-Uo for incoming@patchwork.ozlabs.org; Fri, 20 Nov 2015 04:36:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzi6g-0001JE-9s for qemu-devel@nongnu.org; Fri, 20 Nov 2015 04:35:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zzi6d-00058b-52 for qemu-devel@nongnu.org; Fri, 20 Nov 2015 04:35:50 -0500 Received: from [59.151.112.132] (port=35037 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zzi6c-00051J-Kc for qemu-devel@nongnu.org; Fri, 20 Nov 2015 04:35:47 -0500 X-IronPort-AV: E=Sophos;i="5.20,242,1444665600"; d="scan'208";a="668951" Received: from unknown (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 20 Nov 2015 17:35:11 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id tAK9YdQX005469; Fri, 20 Nov 2015 17:34:39 +0800 Received: from [10.167.226.52] (10.167.226.52) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Fri, 20 Nov 2015 17:35:22 +0800 To: qemu-devl , Paolo Bonzini From: Wen Congyang Message-ID: <564EE92E.4070701@cn.fujitsu.com> Date: Fri, 20 Nov 2015 17:34:38 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 X-Originating-IP: [10.167.226.52] X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 59.151.112.132 Subject: [Qemu-devel] [PATCH for-2.5] call bdrv_drain_all() even if the vm is stopped X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org There are still I/O operations when the vm is stopped. For example, stop the vm, and do block migration. In this case, we don't drain all I/O operation, and may meet the following problem: qemu-system-x86_64: migration/block.c:731: block_save_complete: Assertion `block_mig_state.submitted == 0' failed. Signed-off-by: Wen Congyang --- cpus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cpus.c b/cpus.c index 877bd70..43676fa 100644 --- a/cpus.c +++ b/cpus.c @@ -1415,6 +1415,8 @@ int vm_stop_force_state(RunState state) return vm_stop(state); } else { runstate_set(state); + + bdrv_drain_all(); /* Make sure to return an error if the flush in a previous vm_stop() * failed. */ return bdrv_flush_all();