Signed-off-by: Max Reitz <mre...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> --- block/block-backend.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/block/block-backend.c b/block/block-backend.c index 755262d..76e6893 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -163,12 +163,7 @@ static void blk_delete(BlockBackend *blk) { assert(!blk->refcnt); assert(!blk->dev); - if (blk->bs) { - assert(blk->bs->blk == blk); - blk->bs->blk = NULL; - bdrv_unref(blk->bs); - blk->bs = NULL; - } + blk_remove_bs(blk); /* Avoid double-remove after blk_hide_on_behalf_of_hmp_drive_del() */ if (blk->name[0]) { QTAILQ_REMOVE(&blk_backends, blk, link); @@ -324,6 +319,8 @@ void blk_remove_bs(BlockBackend *blk) return; } + assert(blk->bs->blk == blk); + notifier_list_notify(&blk->remove_bs_notifiers, blk); blk_update_root_state(blk); -- 2.1.0