qemu-block
[Top][All Lists]
Advanced

[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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]