From: Dylan Yudaken Date: Thu, 24 Mar 2022 14:34:35 +0000 (-0700) Subject: io_uring: fix async accept on O_NONBLOCK sockets X-Git-Tag: v6.6.17~7817^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a73825ba70c93e1eb39a845bb3d9885a787f8ffe;p=platform%2Fkernel%2Flinux-rpi.git io_uring: fix async accept on O_NONBLOCK sockets 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. Signed-off-by: Dylan Yudaken Link: https://lore.kernel.org/r/20220324143435.2875844-1-dylany@fb.com Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 28b7a1b..a76e91f 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -5602,9 +5602,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))