block: use co_wrapper_mixed_bdrv_rdlock in functions taking the rdlock
Take the rdlock already, before we add the assertions. All these functions either read the graph recursively, or call BlockDriver callbacks that will eventually need to be protected by the graph rdlock. Do it now to all functions together, because many of these recursively call each other. For example, bdrv_co_truncate calls BlockDriver->bdrv_co_truncate, and some driver callbacks implement their own .bdrv_co_truncate by calling bdrv_flush inside. So if bdrv_flush asserts but bdrv_truncate does not take the rdlock yet, the assertion will always fail. Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com> Message-Id: <20221207131838.239125-18-kwolf@redhat.com> Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
e6d3f7a602
commit
90830f5950
@ -71,7 +71,7 @@ nbd_co_do_establish_connection(BlockDriverState *bs, bool blocking,
|
|||||||
* the "I/O or GS" API.
|
* the "I/O or GS" API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int co_wrapper_mixed
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
bdrv_common_block_status_above(BlockDriverState *bs,
|
bdrv_common_block_status_above(BlockDriverState *bs,
|
||||||
BlockDriverState *base,
|
BlockDriverState *base,
|
||||||
bool include_base,
|
bool include_base,
|
||||||
|
@ -39,19 +39,24 @@
|
|||||||
* to catch when they are accidentally called by the wrong API.
|
* to catch when they are accidentally called by the wrong API.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int co_wrapper_mixed bdrv_pwrite_zeroes(BdrvChild *child, int64_t offset,
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
int64_t bytes,
|
bdrv_pwrite_zeroes(BdrvChild *child, int64_t offset, int64_t bytes,
|
||||||
BdrvRequestFlags flags);
|
BdrvRequestFlags flags);
|
||||||
|
|
||||||
int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags);
|
int bdrv_make_zero(BdrvChild *child, BdrvRequestFlags flags);
|
||||||
int co_wrapper_mixed bdrv_pread(BdrvChild *child, int64_t offset,
|
|
||||||
int64_t bytes, void *buf,
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
BdrvRequestFlags flags);
|
bdrv_pread(BdrvChild *child, int64_t offset, int64_t bytes, void *buf,
|
||||||
int co_wrapper_mixed bdrv_pwrite(BdrvChild *child, int64_t offset,
|
|
||||||
int64_t bytes, const void *buf,
|
|
||||||
BdrvRequestFlags flags);
|
|
||||||
int co_wrapper_mixed bdrv_pwrite_sync(BdrvChild *child, int64_t offset,
|
|
||||||
int64_t bytes, const void *buf,
|
|
||||||
BdrvRequestFlags flags);
|
BdrvRequestFlags flags);
|
||||||
|
|
||||||
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
|
bdrv_pwrite(BdrvChild *child, int64_t offset,int64_t bytes,
|
||||||
|
const void *buf, BdrvRequestFlags flags);
|
||||||
|
|
||||||
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
|
bdrv_pwrite_sync(BdrvChild *child, int64_t offset, int64_t bytes,
|
||||||
|
const void *buf, BdrvRequestFlags flags);
|
||||||
|
|
||||||
int coroutine_fn bdrv_co_pwrite_sync(BdrvChild *child, int64_t offset,
|
int coroutine_fn bdrv_co_pwrite_sync(BdrvChild *child, int64_t offset,
|
||||||
int64_t bytes, const void *buf,
|
int64_t bytes, const void *buf,
|
||||||
BdrvRequestFlags flags);
|
BdrvRequestFlags flags);
|
||||||
@ -287,22 +292,26 @@ int coroutine_fn bdrv_co_copy_range(BdrvChild *src, int64_t src_offset,
|
|||||||
|
|
||||||
void bdrv_drain(BlockDriverState *bs);
|
void bdrv_drain(BlockDriverState *bs);
|
||||||
|
|
||||||
int co_wrapper_mixed
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
bdrv_truncate(BdrvChild *child, int64_t offset, bool exact,
|
bdrv_truncate(BdrvChild *child, int64_t offset, bool exact,
|
||||||
PreallocMode prealloc, BdrvRequestFlags flags, Error **errp);
|
PreallocMode prealloc, BdrvRequestFlags flags, Error **errp);
|
||||||
|
|
||||||
int co_wrapper_mixed bdrv_check(BlockDriverState *bs, BdrvCheckResult *res,
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
BdrvCheckMode fix);
|
bdrv_check(BlockDriverState *bs, BdrvCheckResult *res, BdrvCheckMode fix);
|
||||||
|
|
||||||
/* Invalidate any cached metadata used by image formats */
|
/* Invalidate any cached metadata used by image formats */
|
||||||
int co_wrapper_mixed bdrv_invalidate_cache(BlockDriverState *bs,
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
Error **errp);
|
bdrv_invalidate_cache(BlockDriverState *bs, Error **errp);
|
||||||
int co_wrapper_mixed bdrv_flush(BlockDriverState *bs);
|
|
||||||
int co_wrapper_mixed bdrv_pdiscard(BdrvChild *child, int64_t offset,
|
int co_wrapper_mixed_bdrv_rdlock bdrv_flush(BlockDriverState *bs);
|
||||||
int64_t bytes);
|
|
||||||
int co_wrapper_mixed
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
|
bdrv_pdiscard(BdrvChild *child, int64_t offset, int64_t bytes);
|
||||||
|
|
||||||
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
bdrv_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);
|
bdrv_readv_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);
|
||||||
int co_wrapper_mixed
|
|
||||||
|
int co_wrapper_mixed_bdrv_rdlock
|
||||||
bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);
|
bdrv_writev_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user