block: Remove aio_poll() in bdrv_drain_poll variants
bdrv_drain_poll_top_level() was buggy because it didn't release the
AioContext lock of the node to be drained before calling aio_poll().
This way, callbacks called by aio_poll() would possibly take the lock a
second time and run into a deadlock with a nested AIO_WAIT_WHILE() call.
However, it turns out that the aio_poll() call isn't actually needed any
more. It was introduced in commit 91af091f92
, which is effectively
reverted by this patch. The cases it was supposed to fix are now covered
by bdrv_drain_poll(), which waits for block jobs to reach a quiescent
state.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
b5a7a05735
commit
4cf077b59f
|
@ -268,10 +268,6 @@ bool bdrv_drain_poll(BlockDriverState *bs, bool recursive,
|
||||||
static bool bdrv_drain_poll_top_level(BlockDriverState *bs, bool recursive,
|
static bool bdrv_drain_poll_top_level(BlockDriverState *bs, bool recursive,
|
||||||
BdrvChild *ignore_parent)
|
BdrvChild *ignore_parent)
|
||||||
{
|
{
|
||||||
/* Execute pending BHs first and check everything else only after the BHs
|
|
||||||
* have executed. */
|
|
||||||
while (aio_poll(bs->aio_context, false));
|
|
||||||
|
|
||||||
return bdrv_drain_poll(bs, recursive, ignore_parent, false);
|
return bdrv_drain_poll(bs, recursive, ignore_parent, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,10 +507,6 @@ static bool bdrv_drain_all_poll(void)
|
||||||
BlockDriverState *bs = NULL;
|
BlockDriverState *bs = NULL;
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
|
||||||
/* Execute pending BHs first (may modify the graph) and check everything
|
|
||||||
* else only after the BHs have executed. */
|
|
||||||
while (aio_poll(qemu_get_aio_context(), false));
|
|
||||||
|
|
||||||
/* bdrv_drain_poll() can't make changes to the graph and we are holding the
|
/* bdrv_drain_poll() can't make changes to the graph and we are holding the
|
||||||
* main AioContext lock, so iterating bdrv_next_all_states() is safe. */
|
* main AioContext lock, so iterating bdrv_next_all_states() is safe. */
|
||||||
while ((bs = bdrv_next_all_states(bs))) {
|
while ((bs = bdrv_next_all_states(bs))) {
|
||||||
|
|
Loading…
Reference in a new issue