Patch "io_uring: fix async accept on O_NONBLOCK sockets" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    io_uring: fix async accept on O_NONBLOCK sockets

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     io_uring-fix-async-accept-on-o_nonblock-sockets.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 965d1b22a5e0f21db9f1dd08bf9f07d2799e6f81
Author: Dylan Yudaken <dylany@xxxxxxxx>
Date:   Sat Jan 21 09:13:12 2023 -0700

    io_uring: fix async accept on O_NONBLOCK sockets
    
    commit a73825ba70c93e1eb39a845bb3d9885a787f8ffe upstream.
    
    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@xxxxxx>
    Link: https://lore.kernel.org/r/20220324143435.2875844-1-dylany@xxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index cc8e13de5fa9..8c8ba8c067ca 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -5112,9 +5112,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))
@@ -5127,6 +5124,8 @@ static int io_accept(struct io_kiocb *req, unsigned int issue_flags)
 		if (!fixed)
 			put_unused_fd(fd);
 		ret = PTR_ERR(file);
+		/* safe to retry */
+		req->flags |= REQ_F_PARTIAL_IO;
 		if (ret == -EAGAIN && force_nonblock)
 			return -EAGAIN;
 		if (ret == -ERESTARTSYS)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux