[Qemu-devel] [PATCH] block: remove bs from lists before closing

Anton Kuchin posted 1 patch 6 years, 6 months ago
Test asan passed
Test docker-mingw@fedora passed
Test docker-clang@ubuntu passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190507081256.27599-1-antonkuchin@yandex-team.ru
Maintainers: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>
block.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[Qemu-devel] [PATCH] block: remove bs from lists before closing
Posted by Anton Kuchin 6 years, 6 months ago
Close involves flush that can be performed asynchronously and bs
must be protected from being referenced before it is deleted.

Signed-off-by: Anton Kuchin <antonkuchin@yandex-team.ru>
---
 block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index 9ae5c0ed2f..b505271a4d 100644
--- a/block.c
+++ b/block.c
@@ -4083,14 +4083,14 @@ static void bdrv_delete(BlockDriverState *bs)
     assert(bdrv_op_blocker_is_empty(bs));
     assert(!bs->refcnt);
 
-    bdrv_close(bs);
-
     /* remove from list, if necessary */
     if (bs->node_name[0] != '\0') {
         QTAILQ_REMOVE(&graph_bdrv_states, bs, node_list);
     }
     QTAILQ_REMOVE(&all_bdrv_states, bs, bs_list);
 
+    bdrv_close(bs);
+
     g_free(bs);
 }
 
-- 
2.19.1


Re: [Qemu-devel] [PATCH] block: remove bs from lists before closing
Posted by Kevin Wolf 6 years, 6 months ago
Am 07.05.2019 um 10:12 hat Anton Kuchin geschrieben:
> Close involves flush that can be performed asynchronously and bs
> must be protected from being referenced before it is deleted.
> 
> Signed-off-by: Anton Kuchin <antonkuchin@yandex-team.ru>

Thanks, applied to the block branch.

Kevin