From patchwork Fri May 28 02:44:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MORITA Kazutaka X-Patchwork-Id: 53853 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9E692B7D2D for ; Fri, 28 May 2010 12:54:15 +1000 (EST) Received: from localhost ([127.0.0.1]:51809 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHphr-0004Yo-N4 for incoming@patchwork.ozlabs.org; Thu, 27 May 2010 22:53:55 -0400 Received: from [140.186.70.92] (port=35951 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHpeM-0002gx-LN for qemu-devel@nongnu.org; Thu, 27 May 2010 22:50:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHpeL-0006Aj-9N for qemu-devel@nongnu.org; Thu, 27 May 2010 22:50:18 -0400 Received: from sh.osrg.net ([192.16.179.4]:57334) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHpeK-0006AF-OQ for qemu-devel@nongnu.org; Thu, 27 May 2010 22:50:17 -0400 Received: from fs.osrg.net (postfix@fs.osrg.net [10.0.0.12]) by sh.osrg.net (8.14.3/8.14.3/OSRG-NET) with ESMTP id o4S2nfSi011447; Fri, 28 May 2010 11:49:41 +0900 Received: from localhost (dfs1401.osrg.net [10.68.14.1]) by fs.osrg.net (Postfix) with ESMTP id 7697F3E02F5; Fri, 28 May 2010 11:49:41 +0900 (JST) From: MORITA Kazutaka To: kwolf@redhat.com, aliguori@us.ibm.com, avi@redhat.com Date: Fri, 28 May 2010 11:44:57 +0900 Message-Id: <1275014699-9431-2-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1275014699-9431-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> References: <1275014699-9431-1-git-send-email-morita.kazutaka@lab.ntt.co.jp> X-Dispatcher: imput version 20070423(IM149) Lines: 60 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (sh.osrg.net [192.16.179.4]); Fri, 28 May 2010 11:49:42 +0900 (JST) X-Virus-Scanned: clamav-milter 0.96 at sh X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: sheepdog@lists.wpkg.org, hch@lst.de, kvm@vger.kernel.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [RFC PATCH v4 1/3] close all the block drivers before the qemu process exits X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This patch calls the close handler of the block driver before the qemu process exits. This is necessary because the sheepdog block driver releases the lock of VM images in the close handler. Signed-off-by: MORITA Kazutaka --- block.c | 9 +++++++++ block.h | 1 + vl.c | 1 + 3 files changed, 11 insertions(+), 0 deletions(-) diff --git a/block.c b/block.c index 24c63f6..da0dc47 100644 --- a/block.c +++ b/block.c @@ -646,6 +646,15 @@ void bdrv_close(BlockDriverState *bs) } } +void bdrv_close_all(void) +{ + BlockDriverState *bs; + + QTAILQ_FOREACH(bs, &bdrv_states, list) { + bdrv_close(bs); + } +} + void bdrv_delete(BlockDriverState *bs) { /* remove from list, if necessary */ diff --git a/block.h b/block.h index 756670d..25744b1 100644 --- a/block.h +++ b/block.h @@ -123,6 +123,7 @@ BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, /* Ensure contents are flushed to disk. */ void bdrv_flush(BlockDriverState *bs); void bdrv_flush_all(void); +void bdrv_close_all(void); int bdrv_has_zero_init(BlockDriverState *bs); int bdrv_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, diff --git a/vl.c b/vl.c index 7121cd0..8ffe36f 100644 --- a/vl.c +++ b/vl.c @@ -1992,6 +1992,7 @@ static void main_loop(void) vm_stop(r); } } + bdrv_close_all(); pause_all_vcpus(); }