On Wed, May 31, 2023 at 01:02:27PM +0200, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <[email protected]>
Commit message is sparse, and doesn't mention....
> ---
> block.c | 25 ++++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/block.c b/block.c
> index a0793b6435..954b9923d9 100644
> --- a/block.c
> +++ b/block.c
> @@ -3794,6 +3794,7 @@ static BlockDriverState
> *bdrv_append_temp_snapshot(BlockDriverState *bs,
> int64_t total_size;
> QemuOpts *opts = NULL;
> BlockDriverState *bs_snapshot = NULL;
> + AioContext *ctx = bdrv_get_aio_context(bs);
> int ret;
>
> GLOBAL_STATE_CODE();
> @@ -3802,7 +3803,10 @@ static BlockDriverState
> *bdrv_append_temp_snapshot(BlockDriverState *bs,
> instead of opening 'filename' directly */
>
> /* Get the required size from the image */
> + aio_context_acquire(ctx);
> total_size = bdrv_getlength(bs);
> + aio_context_release(ctx);
> +
> if (total_size < 0) {
> error_setg_errno(errp, -total_size, "Could not get image size");
> goto out;
> @@ -3836,7 +3840,10 @@ static BlockDriverState
> *bdrv_append_temp_snapshot(BlockDriverState *bs,
> goto out;
> }
>
> + aio_context_acquire(ctx);
> ret = bdrv_append(bs_snapshot, bs, errp);
> + aio_context_release(ctx);
> +
> if (ret < 0) {
> bs_snapshot = NULL;
> goto out;
...the changes to bdrv_append_temp_snapshot above.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org