]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: ensure bdrv_drain_all() works during bdrv_delete()
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 27 Jun 2013 13:32:26 +0000 (15:32 +0200)
committerStefan Hajnoczi <stefanha@redhat.com>
Mon, 19 Aug 2013 13:45:34 +0000 (15:45 +0200)
In bdrv_delete() make sure to call bdrv_make_anon() *after* bdrv_close()
so that the device is still seen by bdrv_drain_all() when iterating
bdrv_states.

Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block.c

diff --git a/block.c b/block.c
index 01b66d802a6d221a1f39a2996d5b73ca145a5f9c..d5ce8d39e423b7400bba6c5e92460d8a4ae797b3 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1606,11 +1606,11 @@ void bdrv_delete(BlockDriverState *bs)
     assert(!bs->job);
     assert(!bs->in_use);
 
+    bdrv_close(bs);
+
     /* remove from list, if necessary */
     bdrv_make_anon(bs);
 
-    bdrv_close(bs);
-
     g_free(bs);
 }