From 0487ca6807db23556550e12585924546ed9923af Mon Sep 17 00:00:00 2001 From: Fam Zheng Date: Tue, 21 Jan 2014 02:59:42 +0100 Subject: [PATCH 30/34] block: ensure bdrv_drain_all() works during bdrv_delete() RH-Author: Fam Zheng Message-id: <1390273182-31302-1-git-send-email-famz@redhat.com> Patchwork-id: 56851 O-Subject: [RHEL-7 qemu-kvm PATCH 19/18] block: ensure bdrv_drain_all() works during bdrv_delete() Bugzilla: 1041301 RH-Acked-by: Jeffrey Cody RH-Acked-by: Kevin Wolf RH-Acked-by: Stefan Hajnoczi From: Stefan Hajnoczi 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-stable@nongnu.org Signed-off-by: Stefan Hajnoczi (cherry picked from commit e1b5c52e04d04bb93546c6e37e8884889d047cb1) Signed-off-by: Fam Zheng --- block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Signed-off-by: Miroslav Rezanina --- block.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index b4e3ced..3232971 100644 --- a/block.c +++ b/block.c @@ -1674,11 +1674,11 @@ static void bdrv_delete(BlockDriverState *bs) assert(!bs->in_use); assert(!bs->refcnt); + bdrv_close(bs); + /* remove from list, if necessary */ bdrv_make_anon(bs); - bdrv_close(bs); - g_free(bs); } -- 1.7.1