[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/9] blockdev: hold AioContext f
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/9] blockdev: hold AioContext for bdrv_unref() in external_snapshot_clean() |
Date: |
Thu, 7 Dec 2017 14:32:19 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 12/06/2017 08:45 AM, Stefan Hajnoczi wrote:
> bdrv_unref() requires the AioContext lock because bdrv_flush() uses
> BDRV_POLL_WHILE(), which assumes the AioContext is currently held. If
> BDRV_POLL_WHILE() runs without AioContext held the
> pthread_mutex_unlock() call in aio_context_release() fails.
>
> This patch moves bdrv_unref() into the AioContext locked region to solve
> the following pthread_mutex_unlock() failure:
>
> diff --git a/blockdev.c b/blockdev.c
> index 56a6b24a0b..3c8d994ced 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -1812,8 +1812,8 @@ static void external_snapshot_clean(BlkActionState
> *common)
> DO_UPCAST(ExternalSnapshotState, common,
> common);
> if (state->aio_context) {
> bdrv_drained_end(state->old_bs);
> - aio_context_release(state->aio_context);
> bdrv_unref(state->new_bs);
> + aio_context_release(state->aio_context);
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH v2 0/9] blockdev: fix QMP 'transaction' with IOThreads, Stefan Hajnoczi, 2017/12/06
- [Qemu-block] [PATCH v2 1/9] blockdev: hold AioContext for bdrv_unref() in external_snapshot_clean(), Stefan Hajnoczi, 2017/12/06
- Re: [Qemu-block] [Qemu-devel] [PATCH v2 1/9] blockdev: hold AioContext for bdrv_unref() in external_snapshot_clean(),
Eric Blake <=
- [Qemu-block] [PATCH v2 2/9] block: don't keep AioContext acquired after external_snapshot_prepare(), Stefan Hajnoczi, 2017/12/06
- [Qemu-block] [PATCH v2 3/9] block: don't keep AioContext acquired after drive_backup_prepare(), Stefan Hajnoczi, 2017/12/06
- [Qemu-block] [PATCH v2 4/9] block: don't keep AioContext acquired after blockdev_backup_prepare(), Stefan Hajnoczi, 2017/12/06
- [Qemu-block] [PATCH v2 5/9] block: don't keep AioContext acquired after internal_snapshot_prepare(), Stefan Hajnoczi, 2017/12/06
- [Qemu-block] [PATCH v2 6/9] block: drop unused BlockDirtyBitmapState->aio_context field, Stefan Hajnoczi, 2017/12/06