From patchwork Mon Sep 19 16:44:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Snow X-Patchwork-Id: 671873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sdC6d4GwHz9sC7 for ; Tue, 20 Sep 2016 03:09:28 +1000 (AEST) Received: from localhost ([::1]:56945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm24K-000488-Mp for incoming@patchwork.ozlabs.org; Mon, 19 Sep 2016 13:09:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm1gU-0000ZS-V3 for qemu-devel@nongnu.org; Mon, 19 Sep 2016 12:44:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bm1gQ-0000rV-3p for qemu-devel@nongnu.org; Mon, 19 Sep 2016 12:44:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bm1gK-0000qJ-MZ; Mon, 19 Sep 2016 12:44:36 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22C8BB5608; Mon, 19 Sep 2016 16:44:36 +0000 (UTC) Received: from scv.usersys.redhat.com (dhcp-17-171.bos.redhat.com [10.18.17.171]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8JGiXIu006898; Mon, 19 Sep 2016 12:44:35 -0400 From: John Snow To: qemu-block@nongnu.org Date: Mon, 19 Sep 2016 12:44:31 -0400 Message-Id: <1474303471-12509-3-git-send-email-jsnow@redhat.com> In-Reply-To: <1474303471-12509-1-git-send-email-jsnow@redhat.com> References: <1474303471-12509-1-git-send-email-jsnow@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 19 Sep 2016 16:44:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 2/2] qemu: use bdrv_flush_all for vm_stop et al X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, mreitz@redhat.com, John Snow , qemu-devel@nongnu.org, qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Reimplement bdrv_flush_all for vm_stop. In contrast to blk_flush_all, bdrv_flush_all does not have device model restrictions. This allows us to flush and halt unconditionally without error. This allows us to do things like migrate when we have a device with an open tray, but has a node that may need to be flushed, or nodes that aren't currently attached to any device and need to be flushed. Specifically, this allows us to migrate when we have a CDROM with an open tray. Signed-off-by: John Snow Reviewed-by: Kevin Wolf --- cpus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpus.c b/cpus.c index e39ccb7..96d9352 100644 --- a/cpus.c +++ b/cpus.c @@ -751,7 +751,7 @@ static int do_vm_stop(RunState state) } bdrv_drain_all(); - ret = blk_flush_all(); + ret = bdrv_flush_all(); return ret; } @@ -1494,7 +1494,7 @@ int vm_stop_force_state(RunState state) bdrv_drain_all(); /* Make sure to return an error if the flush in a previous vm_stop() * failed. */ - return blk_flush_all(); + return bdrv_flush_all(); } }