From 0ebb812e35c867109de16a55e513a817ca67e45c Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Tue, 1 Feb 2011 13:32:37 -0200 Subject: [PATCH 17/28] close all the block drivers before the qemu process exits RH-Author: Kevin Wolf Message-id: <1296567161-8837-2-git-send-email-kwolf@redhat.com> Patchwork-id: 17409 O-Subject: [RHEL-6.1 qemu-kvm PATCH v2 1/5] close all the block drivers before the qemu process exits Bugzilla: 635527 RH-Acked-by: Markus Armbruster RH-Acked-by: Avi Kivity RH-Acked-by: Jes Sorensen From: MORITA Kazutaka Bugzilla: 635527 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 Signed-off-by: Kevin Wolf (cherry picked from commit 2bc93fed76c89f7adaa0e5bb357dcdc6c2b097a8) --- block.c | 9 +++++++++ block.h | 1 + vl.c | 1 + 3 files changed, 11 insertions(+), 0 deletions(-) Signed-off-by: Luiz Capitulino --- 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 7541a72..6b66fb4 100644 --- a/block.c +++ b/block.c @@ -647,6 +647,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 72e43a3..af88469 100644 --- a/block.h +++ b/block.h @@ -138,6 +138,7 @@ BlockDriverAIOCB *bdrv_aio_ioctl(BlockDriverState *bs, /* Ensure contents are flushed to disk. */ int 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 a9401f8..f821364 100644 --- a/vl.c +++ b/vl.c @@ -4610,6 +4610,7 @@ static void main_loop(void) vm_stop(r); } } + bdrv_close_all(); pause_all_vcpus(); } -- 1.7.4.rc1.16.gd2f15e