[PATCH] io_uring: include file O_NONBLOCK state for, recvmsg/sendmsg

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

 



We only check for MSG_DONTWAIT in terms of whether or not we should
be completing with -EAGAIN or retrying, ensure that we check the
file O_NONBLOCK flag as well.

Cc: stable@xxxxxxxxxxxxxxx # v5.3+
Fixes: 0fa03c624d8f ("io_uring: add support for sendmsg()")
Fixes: aa1fa28fc73e ("io_uring: add support for recvmsg()")
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
 fs/io_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 0b51f21e5432..792720b2c01e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3654,7 +3654,7 @@ static int io_sendmsg(struct io_kiocb *req, bool force_nonblock)
 		}
 
 		flags = req->sr_msg.msg_flags;
-		if (flags & MSG_DONTWAIT)
+		if ((flags & MSG_DONTWAIT) || (req->file->f_flags & O_NONBLOCK))
 			req->flags |= REQ_F_NOWAIT;
 		else if (force_nonblock)
 			flags |= MSG_DONTWAIT;
@@ -3899,7 +3899,7 @@ static int io_recvmsg(struct io_kiocb *req, bool force_nonblock)
 		}
 
 		flags = req->sr_msg.msg_flags;
-		if (flags & MSG_DONTWAIT)
+		if ((flags & MSG_DONTWAIT) || (req->file->f_flags & O_NONBLOCK))
 			req->flags |= REQ_F_NOWAIT;
 		else if (force_nonblock)
 			flags |= MSG_DONTWAIT;
-- 
2.26.2

-- 
Jens Axboe




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux