Skip to content

Commit a73825b

Browse files
Dylan Yudakenaxboe
authored andcommitted
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 <dylany@fb.com> Link: https://lore.kernel.org/r/20220324143435.2875844-1-dylany@fb.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 7ef66d1 commit a73825b

1 file changed

Lines changed: 0 additions & 3 deletions

File tree

fs/io_uring.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5602,9 +5602,6 @@ static int io_accept(struct io_kiocb *req, unsigned int issue_flags)
56025602
struct file *file;
56035603
int ret, fd;
56045604

5605-
if (req->file->f_flags & O_NONBLOCK)
5606-
req->flags |= REQ_F_NOWAIT;
5607-
56085605
if (!fixed) {
56095606
fd = __get_unused_fd_flags(accept->flags, accept->nofile);
56105607
if (unlikely(fd < 0))

0 commit comments

Comments
 (0)