]> git.proxmox.com Git - mirror_qemu.git/commit
block: Call .bdrv_co_create(_opts) unlocked
authorKevin Wolf <kwolf@redhat.com>
Wed, 10 May 2023 20:35:54 +0000 (22:35 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 19 May 2023 17:12:12 +0000 (19:12 +0200)
commit4db7ba3b87447fd06cd7e23dab69fdae6011496d
tree573bd54b127d2127d927fe7534d4296dee4e4a1c
parent41f8b633393021923fd555d8d94bded2f8f6f05d
block: Call .bdrv_co_create(_opts) unlocked

These are functions that modify the graph, so they must be able to take
a writer lock. This is impossible if they already hold the reader lock.
If they need a reader lock for some of their operations, they should
take it internally.

Many of them go through blk_*(), which will always take the lock itself.
Direct calls of bdrv_*() need to take the reader lock. Note that while
locking for bdrv_co_*() calls is checked by TSA, this is not the case
for the mixed_coroutine_fns bdrv_*(). Holding the lock is still required
when they are called from coroutine context like here!

This effectively reverts 4ec8df0183, but adds some internal locking
instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20230510203601.418015-2-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 files changed:
block.c
block/create.c
block/crypto.c
block/parallels.c
block/qcow.c
block/qcow2.c
block/qed.c
block/raw-format.c
block/vdi.c
block/vhdx.c
block/vmdk.c
block/vpc.c
include/block/block-global-state.h
include/block/block_int-common.h