qemu-e2k/include/block
Kevin Wolf 6bc0bcc89f block: Fix deadlocks in bdrv_graph_wrunlock()
bdrv_graph_wrunlock() calls aio_poll(), which may run callbacks that
have a nested event loop. Nested event loops can depend on other
iothreads making progress, so in order to allow them to make progress it
must not hold the AioContext lock of another thread while calling
aio_poll().

This introduces a @bs parameter to bdrv_graph_wrunlock() whose
AioContext is temporarily dropped (which matches bdrv_graph_wrlock()),
and a bdrv_graph_wrunlock_ctx() that can be used if the BlockDriverState
doesn't necessarily exist any more when unlocking.

This also requires a change to bdrv_schedule_unref(), which was relying
on the incorrectly taken lock. It needs to take the lock itself now.
While this is a separate bug, it can't be fixed a separate patch because
otherwise the intermediate state would either deadlock or try to release
a lock that we don't even hold.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231115172012.112727-3-kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[kwolf: Fixed up bdrv_schedule_unref()]
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2023-11-21 12:45:21 +01:00
..
accounting.h
aio_task.h
aio-wait.h
aio.h block: mark aio_poll as non-coroutine 2023-09-20 17:46:16 +02:00
block_backup.h
block_int-common.h block: Protect bs->file with graph_lock 2023-11-08 17:56:18 +01:00
block_int-global-state.h block: Mark bdrv_skip_implicit_filters() and callers GRAPH_RDLOCK 2023-11-07 19:14:19 +01:00
block_int-io.h block: Mark bdrv_cow_child() and callers GRAPH_RDLOCK 2023-11-07 19:14:19 +01:00
block_int.h
block-common.h block-coroutine-wrapper: Add no_co_wrapper_bdrv_rdlock functions 2023-10-12 16:31:33 +02:00
block-copy.h
block-global-state.h block: Introduce bdrv_co_change_backing_file() 2023-11-08 17:56:17 +01:00
block-hmp-cmds.h
block-io.h block: Introduce bdrv_co_change_backing_file() 2023-11-08 17:56:17 +01:00
block.h
blockjob_int.h block: Mark block_job_add_bdrv() GRAPH_WRLOCK 2023-11-07 19:14:19 +01:00
blockjob.h block: Mark block_job_add_bdrv() GRAPH_WRLOCK 2023-11-07 19:14:19 +01:00
dirty-bitmap.h
export.h
fuse.h
graph-lock.h block: Fix deadlocks in bdrv_graph_wrunlock() 2023-11-21 12:45:21 +01:00
nbd.h nbd/server: Prepare for per-request filtering of BLOCK_STATUS 2023-10-05 11:02:08 -05:00
nvme.h
qapi.h block: Mark bdrv_get_parent_name() and callers GRAPH_RDLOCK 2023-10-12 16:31:33 +02:00
qdict.h
raw-aio.h
replication.h
reqlist.h
snapshot.h block: Mark bdrv_snapshot_fallback() and callers GRAPH_RDLOCK 2023-10-12 16:31:33 +02:00
thread-pool.h
throttle-groups.h block/throttle-groups: Use ThrottleDirection instread of bool is_write 2023-08-29 10:49:24 +02:00
ufs.h include/block/ufs.h: spelling fix: setted 2023-11-15 12:06:04 +03:00
write-threshold.h