From: Pavel Begunkov <asml.silence@gmail.com>
To: Jens Axboe <axboe@kernel.dk>, io-uring@vger.kernel.org
Cc: dw@davidwei.uk
Subject: Re: [PATCH 1/1] io_uring/poll: fix POLLERR handling
Date: Mon, 14 Jul 2025 16:30:44 +0100 [thread overview]
Message-ID: <dd1306f6-faae-4c90-bc1a-9f9639b102d6@gmail.com> (raw)
In-Reply-To: <62c40bff-f12e-456d-8d68-5cf5c696c743@kernel.dk>
On 7/14/25 15:56, Jens Axboe wrote:
> On 7/14/25 4:59 AM, Pavel Begunkov wrote:
>> 8c8492ca64e7 ("io_uring/net: don't retry connect operation on EPOLLERR")
>> is a little dirty hack that
>> 1) wrongfully assumes that POLLERR equals to a failed request, which
>> breaks all POLLERR users, e.g. all error queue recv interfaces.
>> 2) deviates the connection request behaviour from connect(2), and
>> 3) racy and solved at a wrong level.
>>
>> Nothing can be done with 2) now, and 3) is beyond the scope of the
>> patch. At least solve 1) by moving the hack out of generic poll handling
>> into io_connect().
>>
>> Cc: stable@vger.kernel.org
>> Fixes: 8c8492ca64e79 ("io_uring/net: don't retry connect operation on EPOLLERR")
>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>> ---
>> io_uring/net.c | 4 +++-
>> io_uring/poll.c | 2 --
>> 2 files changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/io_uring/net.c b/io_uring/net.c
>> index 43a43522f406..e2213e4d9420 100644
>> --- a/io_uring/net.c
>> +++ b/io_uring/net.c
>> @@ -1732,13 +1732,15 @@ int io_connect_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
>>
>> int io_connect(struct io_kiocb *req, unsigned int issue_flags)
>> {
>> + struct poll_table_struct pt = { ._key = EPOLLERR };
>> struct io_connect *connect = io_kiocb_to_cmd(req, struct io_connect);
>> struct io_async_msghdr *io = req->async_data;
>> unsigned file_flags;
>> int ret;
>> bool force_nonblock = issue_flags & IO_URING_F_NONBLOCK;
>>
>> - if (unlikely(req->flags & REQ_F_FAIL)) {
>> + ret = vfs_poll(req->file, &pt) & req->apoll_events;
>> + if (ret & EPOLLERR) {
>> ret = -ECONNRESET;
>> goto out;
>
> Is this req->apoll_events masking necessary or useful?
good point, shouldn't be here
--
Pavel Begunkov
next prev parent reply other threads:[~2025-07-14 15:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 10:59 [PATCH 1/1] io_uring/poll: fix POLLERR handling Pavel Begunkov
2025-07-14 14:56 ` Jens Axboe
2025-07-14 15:30 ` Pavel Begunkov [this message]
2025-07-14 17:51 ` Jens Axboe
2025-07-14 20:45 ` Jens Axboe
2025-07-15 9:06 ` Pavel Begunkov
2025-07-15 18:13 ` Jens Axboe
2025-07-15 19:12 ` Jens Axboe
2025-07-16 16:18 ` Pavel Begunkov
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=dd1306f6-faae-4c90-bc1a-9f9639b102d6@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=dw@davidwei.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox