[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/9] block: don't keep AioContext acquired af
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/9] block: don't keep AioContext acquired after external_snapshot_prepare() |
Date: |
Thu, 7 Dec 2017 14:37:52 -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:
> It is not necessary to hold AioContext across transactions anymore since
> bdrv_drained_begin/end() is used to keep the nodes quiesced. In fact,
> using the AioContext lock for this purpose was always buggy.
>
> This patch reduces the scope of AioContext locked regions. This is not
> just a cleanup but also fixes hangs that occur in BDRV_POLL_WHILE()
> because it is unware of recursive locking and does not release the
s/unware/unaware/
> AioContext the necessary number of times to allow progress to be made.
>
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> blockdev.c | 71
> ++++++++++++++++++++++++++++++++++++++++++--------------------
> 1 file changed, 48 insertions(+), 23 deletions(-)
>
> @@ -1662,31 +1662,32 @@ static void external_snapshot_prepare(BlkActionState
> *common,
> return;
> }
>
> - /* Acquire AioContext now so any threads operating on old_bs stop */
> - state->aio_context = bdrv_get_aio_context(state->old_bs);
> - aio_context_acquire(state->aio_context);
> + aio_context = bdrv_get_aio_context(state->old_bs);
> + aio_context_acquire(aio_context);
> +
> + /* Paired with .clean() */
> bdrv_drained_begin(state->old_bs);
>
> if (!bdrv_is_inserted(state->old_bs)) {
> error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
> - return;
> + goto out;
> }
Using gcc/clang's __attribute__((cleanup)) would make this so much nicer ;)
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-devel] [PATCH v2 0/9] blockdev: fix QMP 'transaction' with IOThreads, Stefan Hajnoczi, 2017/12/06
- [Qemu-devel] [PATCH v2 1/9] blockdev: hold AioContext for bdrv_unref() in external_snapshot_clean(), Stefan Hajnoczi, 2017/12/06
- [Qemu-devel] [PATCH v2 2/9] block: don't keep AioContext acquired after external_snapshot_prepare(), Stefan Hajnoczi, 2017/12/06
- Re: [Qemu-devel] [PATCH v2 2/9] block: don't keep AioContext acquired after external_snapshot_prepare(),
Eric Blake <=
- [Qemu-devel] [PATCH v2 3/9] block: don't keep AioContext acquired after drive_backup_prepare(), Stefan Hajnoczi, 2017/12/06
- [Qemu-devel] [PATCH v2 4/9] block: don't keep AioContext acquired after blockdev_backup_prepare(), Stefan Hajnoczi, 2017/12/06
- [Qemu-devel] [PATCH v2 5/9] block: don't keep AioContext acquired after internal_snapshot_prepare(), Stefan Hajnoczi, 2017/12/06
- [Qemu-devel] [PATCH v2 6/9] block: drop unused BlockDirtyBitmapState->aio_context field, Stefan Hajnoczi, 2017/12/06
- [Qemu-devel] [PATCH v2 7/9] iothread: add iothread_by_id() API, Stefan Hajnoczi, 2017/12/06