Reviewed-by: Wenchao Xia <xiaw...@linux.vnet.ibm.com> One question: old code missed itself in bdrv_drain_all(), is that a bug?
> 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-sta...@nongnu.org > Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com> > --- > block.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/block.c b/block.c > index 6cd39fa..9d68270 100644 > --- a/block.c > +++ b/block.c > @@ -1600,11 +1600,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); > } > -- Best Regards Wenchao Xia