On Thu, Mar 23, 2023 at 06:02:36AM +0100, Paolo Bonzini wrote:
> Il mer 22 mar 2023, 15:55 Stefan Hajnoczi ha scritto:
>
> > +/* The list must not change while we add fds to epoll */
> > +if (!qemu_lockcnt_dec_if_lock(>list_lock)) {
> > +return false;
> > +}
> > +
> > +ok
Il mer 22 mar 2023, 15:55 Stefan Hajnoczi ha scritto:
> +/* The list must not change while we add fds to epoll */
> +if (!qemu_lockcnt_dec_if_lock(>list_lock)) {
> +return false;
> +}
> +
> +ok = fdmon_epoll_try_enable(ctx);
> +
> +qemu_lockcnt_unlock(>list_lock);
>
If another thread calls aio_set_fd_handler() while the IOThread event
loop is upgrading from ppoll(2) to epoll(7) then we might miss new
AioHandlers. The epollfd will not monitor the new AioHandler's fd,
resulting in hangs.
Take the AioHandler list lock while upgrading to epoll. This prevents