If the driver owns some dirty bitmaps, this assertion will fail.

The correct place to release them is in bdrv_close, so move the
assertion one line down.

Signed-off-by: Fam Zheng <f...@redhat.com>
---
 block.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/block.c b/block.c
index afb71c0..fa6ad1d 100644
--- a/block.c
+++ b/block.c
@@ -2348,10 +2348,11 @@ static void bdrv_delete(BlockDriverState *bs)
     assert(!bs->job);
     assert(bdrv_op_blocker_is_empty(bs));
     assert(!bs->refcnt);
-    assert(QLIST_EMPTY(&bs->dirty_bitmaps));
 
     bdrv_close(bs);
 
+    assert(QLIST_EMPTY(&bs->dirty_bitmaps));
+
     /* remove from list, if necessary */
     bdrv_make_anon(bs);
 
-- 
2.4.3


Reply via email to