Message ID | 1453917600-2663-9-git-send-email-mreitz@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Wed, 01/27 18:59, Max Reitz wrote: > Signed-off-by: Max Reitz <mreitz@redhat.com> > Reviewed-by: Kevin Wolf <kwolf@redhat.com> > --- > block/block-backend.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/block/block-backend.c b/block/block-backend.c > index 621787c..7f5ad59 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -166,10 +166,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); > } > assert(QLIST_EMPTY(&blk->remove_bs_notifiers.notifiers)); > assert(QLIST_EMPTY(&blk->insert_bs_notifiers.notifiers)); > @@ -351,6 +348,8 @@ void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk) > */ > void blk_remove_bs(BlockBackend *blk) > { > + assert(blk->bs->blk == blk); > + > notifier_list_notify(&blk->remove_bs_notifiers, blk); > > blk_update_root_state(blk); > -- > 2.7.0 > Reviewed-by: Fam Zheng <famz@redhat.com>
diff --git a/block/block-backend.c b/block/block-backend.c index 621787c..7f5ad59 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -166,10 +166,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); } assert(QLIST_EMPTY(&blk->remove_bs_notifiers.notifiers)); assert(QLIST_EMPTY(&blk->insert_bs_notifiers.notifiers)); @@ -351,6 +348,8 @@ void blk_hide_on_behalf_of_hmp_drive_del(BlockBackend *blk) */ void blk_remove_bs(BlockBackend *blk) { + assert(blk->bs->blk == blk); + notifier_list_notify(&blk->remove_bs_notifiers, blk); blk_update_root_state(blk);