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 <dylany@xxxxxx> --- 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