[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 01/12] block-coroutine-wrapper: Take AioContext lock in no_co
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH 01/12] block-coroutine-wrapper: Take AioContext lock in no_co_wrappers |
Date: |
Thu, 25 May 2023 14:15:44 -0400 |
On Thu, May 25, 2023 at 02:47:02PM +0200, Kevin Wolf wrote:
> All of the functions that currently take a BlockDriverState, BdrvChild
> or BlockBackend as their first parameter expect the associated
> AioContext to be locked when they are called. In the case of
> no_co_wrappers, they are called from bottom halves directly in the main
> loop, so no other caller can be expected to take the lock for them. This
> can result in assertion failures because a lock that isn't taken is
> released in nested event loops.
>
> Looking at the first parameter is already done by co_wrappers to decide
> where the coroutine should run, so doing the same in no_co_wrappers is
> only consistent. Take the lock in the generated bottom halves to fix the
> problem.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
> include/block/block-common.h | 3 +++
> block/block-backend.c | 7 ++++++-
> scripts/block-coroutine-wrapper.py | 25 +++++++++++++++----------
> 3 files changed, 24 insertions(+), 11 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
signature.asc
Description: PGP signature
- [PATCH 00/12] block: Fix blockdev-create with iothreads, Kevin Wolf, 2023/05/25
- [PATCH 01/12] block-coroutine-wrapper: Take AioContext lock in no_co_wrappers, Kevin Wolf, 2023/05/25
- Re: [PATCH 01/12] block-coroutine-wrapper: Take AioContext lock in no_co_wrappers,
Stefan Hajnoczi <=
- [PATCH 03/12] block: Take main AioContext lock when calling bdrv_open(), Kevin Wolf, 2023/05/25
- [PATCH 05/12] mirror: Hold main AioContext lock for calling bdrv_open_backing_file(), Kevin Wolf, 2023/05/25
- [PATCH 07/12] raw-format: Fix open with 'file' in iothread, Kevin Wolf, 2023/05/25
- [PATCH 12/12] iotests: Test blockdev-create in iothread, Kevin Wolf, 2023/05/25
- [PATCH 08/12] copy-before-write: Fix open with child in iothread, Kevin Wolf, 2023/05/25