From: Dylan Yudaken <[email protected]>
To: Jens Axboe <[email protected]>,
Pavel Begunkov <[email protected]>,
<[email protected]>
Cc: <[email protected]>, Dylan Yudaken <[email protected]>
Subject: [PATCH] io_uring: allow async accept on O_NONBLOCK sockets
Date: Thu, 24 Mar 2022 07:34:35 -0700 [thread overview]
Message-ID: <[email protected]> (raw)
Do not set REQ_F_NOWAIT if the socket is non blocking. When enabled this
causes the accept to immediately post a CQE with EAGAIN, which means you
cannot perform an accept SQE on a NONBLOCK socket asynchronously.
By removing the flag if there is no pending accept then poll is armed as
usual and when a connection comes in the CQE is posted.
note: If multiple accepts are queued up, then when a single connection
comes in they all complete, one with the connection, and the remaining
with EAGAIN. This could be improved in the future but will require a lot
of io_uring changes.
Signed-off-by: Dylan Yudaken <[email protected]>
---
fs/io_uring.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 88556e654c5a..a2a71e76e0da 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5603,9 +5603,6 @@ static int io_accept(struct io_kiocb *req, unsigned int issue_flags)
struct file *file;
int ret, fd;
- if (req->file->f_flags & O_NONBLOCK)
- req->flags |= REQ_F_NOWAIT;
-
if (!fixed) {
fd = __get_unused_fd_flags(accept->flags, accept->nofile);
if (unlikely(fd < 0))
base-commit: 8a3e8ee56417f5e0e66580d93941ed9d6f4c8274
--
2.30.2
next reply other threads:[~2022-03-24 14:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 14:34 Dylan Yudaken [this message]
2022-03-24 14:42 ` [PATCH] io_uring: allow async accept on O_NONBLOCK sockets Jens Axboe
2022-03-24 14:46 ` Jens Axboe
2022-03-24 14:52 ` Dylan Yudaken
2022-03-24 18:09 ` 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 \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/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