[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 03/12] block: Take main AioContext lock when calling bdrv_ope
From: |
Kevin Wolf |
Subject: |
Re: [PATCH 03/12] block: Take main AioContext lock when calling bdrv_open() |
Date: |
Fri, 26 May 2023 10:27:13 +0200 |
Am 25.05.2023 um 20:20 hat Stefan Hajnoczi geschrieben:
> On Thu, May 25, 2023 at 02:47:04PM +0200, Kevin Wolf wrote:
> > The function documentation already says that all callers must hold the
> > main AioContext lock, but not all of them do. This can cause assertion
> > failures when functions called by bdrv_open() try to drop the lock. Fix
> > a few more callers to take the lock before calling bdrv_open().
>
> Did you audit the code to check that there are no cases where
> aio_context_acquire() is now called twice, leading to aio_poll() hangs?
Yes, I did go through (hopefully) all callers, so I should have caught
all of them.
I'm pretty sure that at this point in the series there are some callers
that call it while locking the wrong AioContext, but by the end of the
series they should have disappeared. This is where I couldn't find any
patch order that keeps things fully working in all intermediate steps,
but having a single giant patch felt even worse.
The good thing is that locking the main context multiple times is
harmless because we're running in the main thread, so nested event loops
can make progress even if it's still locked. (This patch, and some
others in the series, rely on this.)
Kevin
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
- [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
- [PATCH 04/12] block-backend: Fix blk_new_open() for iothreads, Kevin Wolf, 2023/05/25