qcow2: Don't call bdrv_getlength() in coroutine_fns

There is a bdrv_co_getlength() now, which should be used in coroutine
context.

This requires adding GRAPH_RDLOCK to some functions so that this still
compiles with TSA because bdrv_co_getlength() is GRAPH_RDLOCK.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20230504115750.54437-2-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Kevin Wolf 2023-05-04 13:57:31 +02:00
parent 6dab4c93ec
commit 0050c163ff
3 changed files with 13 additions and 12 deletions

View file

@ -3715,7 +3715,7 @@ int coroutine_fn qcow2_detect_metadata_preallocation(BlockDriverState *bs)
qemu_co_mutex_assert_locked(&s->lock);
file_length = bdrv_getlength(bs->file->bs);
file_length = bdrv_co_getlength(bs->file->bs);
if (file_length < 0) {
return file_length;
}