On Wed, Dec 01, 2021 at 12:55:08PM +0100, Stefano Garzarella wrote: > On Tue, Nov 30, 2021 at 11:20:57AM +0000, Stefan Hajnoczi wrote: > > @@ -657,10 +704,7 @@ bool aio_poll(AioContext *ctx, bool blocking) > > } > > > > progress |= aio_bh_poll(ctx); > > - > > - if (ret > 0) { > > - progress |= aio_dispatch_ready_handlers(ctx, &ready_list); > > - } > > + progress |= aio_dispatch_ready_handlers(ctx, &ready_list); > > I honestly don't know this code well, so this change isn't clear to me. > > IIUC this is necessary because we now use REVENTS_POLL_READY, so even if > `wait` is interrupted, we want to run the handlers ready so far. > Or maybe is it an unrelated optimization?
Previously we didn't need to run aio_dispatch_ready_handlers() in polling mode (ret would be 0). Now we do, so the conditional needs to be removed. There is no change for the ctx->fdmon_ops->wait() -EINTR case. fdmon won't add handlers to ready_list when returning -EINTR and previously polling would run handlers immediately. In order to preserve that behavior we now need to call aio_dispatch_ready_handlers() unconditionally because polling may have added handlers. Stefan
signature.asc
Description: PGP signature