* [PATCH] io_uring: check file O_NONBLOCK state for accept
@ 2020-06-10 5:41 Jiufei Xue
2020-06-11 0:06 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Jiufei Xue @ 2020-06-10 5:41 UTC (permalink / raw)
To: io-uring; +Cc: axboe, joseph.qi
If the socket is O_NONBLOCK, we should complete the accept request
with -EAGAIN when data is not ready.
Signed-off-by: Jiufei Xue <[email protected]>
---
fs/io_uring.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/io_uring.c b/fs/io_uring.c
index a476112..b8102b2 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3969,6 +3969,9 @@ static int io_accept(struct io_kiocb *req, bool force_nonblock)
{
int ret;
+ if (req->file->f_flags & O_NONBLOCK)
+ req->flags |= REQ_F_NOWAIT;
+
ret = __io_accept(req, force_nonblock);
if (ret == -EAGAIN && force_nonblock) {
req->work.func = io_accept_finish;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] io_uring: check file O_NONBLOCK state for accept
2020-06-10 5:41 [PATCH] io_uring: check file O_NONBLOCK state for accept Jiufei Xue
@ 2020-06-11 0:06 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-06-11 0:06 UTC (permalink / raw)
To: Jiufei Xue, io-uring; +Cc: joseph.qi
On 6/9/20 11:41 PM, Jiufei Xue wrote:
> If the socket is O_NONBLOCK, we should complete the accept request
> with -EAGAIN when data is not ready.
Applied, thanks.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-11 0:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-10 5:41 [PATCH] io_uring: check file O_NONBLOCK state for accept Jiufei Xue
2020-06-11 0:06 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox