From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring <io-uring@vger.kernel.org>
Cc: francis <francis@brosseau.dev>
Subject: Re: [PATCH] io_uring/poll: fix multishot recv missing EOF on wakeup race
Date: Mon, 16 Mar 2026 14:17:02 +0000 [thread overview]
Message-ID: <2e2d6e81-bf95-47bf-9c70-1b2f8b63cfbc@gmail.com> (raw)
In-Reply-To: <8688cc4e-8619-4392-8d5c-93c554d70c34@kernel.dk>
On 3/15/26 16:19, Jens Axboe wrote:
> When a socket send and shutdown() happen back-to-back, both fire
> wake-ups before the receiver's task_work has a chance to run. The first
> wake gets poll ownership (poll_refs=1), and the second bumps it to 2.
> When io_poll_check_events() runs, it calls io_poll_issue() which does a
> recv that reads the data and returns IOU_RETRY. The loop then drains all
> accumulated refs (atomic_sub_return(2) -> 0) and exits, even though only
> the first event was consumed. Since the shutdown is a persistent state
> change, no further wakeups will happen, and the multishot recv can hang
> forever.
>
> Fix this by only draining a single poll ref after io_poll_issue()
> returns IOU_RETRY for the APOLL_MULTISHOT path. If additional wakes
> raced in (poll_refs was > 1), the loop iterates again, vfs_poll()
> discovers the remaining state.
How often will iterate with no effect for normal execution (i.e.
no shutdown)? And how costly it'll be? Why not handle HUP instead?
--
Pavel Begunkov
next prev parent reply other threads:[~2026-03-16 14:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-15 16:19 [PATCH] io_uring/poll: fix multishot recv missing EOF on wakeup race Jens Axboe
2026-03-16 14:17 ` Pavel Begunkov [this message]
2026-03-16 14:28 ` Jens Axboe
2026-03-16 14:40 ` Pavel Begunkov
2026-03-16 14:44 ` Pavel Begunkov
2026-03-16 15:16 ` Jens Axboe
2026-03-16 18:40 ` Jens Axboe
2026-03-16 22:24 ` Pavel Begunkov
2026-03-16 22:31 ` Jens Axboe
2026-03-16 23:08 ` Pavel Begunkov
2026-03-17 1:14 ` Jens Axboe
2026-03-17 1:36 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2e2d6e81-bf95-47bf-9c70-1b2f8b63cfbc@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=francis@brosseau.dev \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.