]> git.proxmox.com Git - qemu.git/commitdiff
close all the block drivers before the qemu process exits
authorMORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Fri, 28 May 2010 02:44:57 +0000 (11:44 +0900)
committerKevin Wolf <kwolf@redhat.com>
Fri, 4 Jun 2010 09:43:40 +0000 (11:43 +0200)
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 <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
block.h
vl.c

diff --git a/block.c b/block.c
index ecd98675a5aa923b5d54c73c9a7d985628e044b1..b1ef85c8da9178f66baf34a651321311c5f43276 100644 (file)
--- a/block.c
+++ b/block.c
@@ -648,6 +648,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 756670d22fe02fbb67727f205e1367401ec75d43..25744b134fde45579f87ba93c6f2958d5340bb64 100644 (file)
--- 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 2769d1a4bc6d51ffd24ac16758d99e3fba610048..551138f0ccdeebb164b9b881ffa6bf6138823509 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -1991,6 +1991,7 @@ static void main_loop(void)
             vm_stop(r);
         }
     }
+    bdrv_close_all();
     pause_all_vcpus();
 }