Skip to contentSkip to conversation

io_uring: check file O_NONBLOCK state for accept

PATCH Applied Jiufei Xue 2 participants 2 messages Jun 10, 2020 – Jun 11, 2020

Subsystems (2)
lore
Share & tools
lore

Jiufei Xue

author
#0 lore raw

PATCH 1/1 io_uring: check file O_NONBLOCK state for accept

If the socket is O_NONBLOCK, we should complete the accept request with -EAGAIN when data is not ready.

---
 fs/io_uring.c | 3 +++
 1 file changed, 3 insertions(+)
fs/io_uring.c +3 -0
index a476112..b8102b2 100644
@@ -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;
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Jiufei Xue

If the socket is O_NONBLOCK, we should complete the accept request with -EAGAIN when data is not ready.

Applied, thanks.

Signature · 1 line
Jens Axboe