[v2,09/11] block: add assertion to check refcount before deleting
diff mbox

Message ID 1374054136-28741-10-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng July 17, 2013, 9:42 a.m. UTC
If BDS is managed with refcnt, we should not call bdrv_delete()
directly, instead bdrv_unref() should be used. Adding assertion to
ensure this.

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

Patch
diff mbox

diff --git a/block.c b/block.c
index 499de22..147a448 100644
--- a/block.c
+++ b/block.c
@@ -1606,6 +1606,8 @@  void bdrv_delete(BlockDriverState *bs)
 {
     assert(!bs->dev);
     assert(!bs->job);
+    assert(!bs->refcnt_soft);
+    assert(!bs->refcnt_hard);
 
     /* remove from list, if necessary */
     bdrv_make_anon(bs);