[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