OSDN Git Service

block: Fix bdrv_graph_wrlock() call in blk_remove_bs()
authorKevin Wolf <kwolf@redhat.com>
Wed, 15 Nov 2023 17:20:09 +0000 (18:20 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 21 Nov 2023 11:45:21 +0000 (12:45 +0100)
commitbb092d6d8f53b9a5ce76e3f5a5a66e6a0475295f
treea5881a6651d4060e473024d33df00a4f95d12196
parenteabb921250666501ae78714b60090200b639fcfe
block: Fix bdrv_graph_wrlock() call in blk_remove_bs()

While not all callers of blk_remove_bs() are correct in this respect,
the assumption in the function is that callers hold the AioContext lock
of the BlockBackend (this is required by the drain calls in it).

In order to avoid deadlock in the nested event loop, bdrv_graph_wrlock()
has then to be called with the root BlockDriverState as its parameter
instead of NULL, so that this AioContext lock is temporarily dropped.

Fixes: https://issues.redhat.com/browse/RHEL-1761
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231115172012.112727-2-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c