Skip to contentSkip to conversation

io_uring/rw: fix wrong NOWAIT check in io_rw_init_file()

PATCH New Jens Axboe 1 participant 1 message Oct 19, 2024 io_uring

lore
Share & tools
lore

Jens Axboe

author maintainer
#0 lore raw

PATCH 1/1 io_uring/rw: fix wrong NOWAIT check in io_rw_init_file()

A previous commit improved how !FMODE_NOWAIT is dealt with, but inadvertently negated a check whilst doing so. This caused -EAGAIN to be returned from reading files with O_NONBLOCK set. Fix up the check for REQ_F_SUPPORT_NOWAIT.

Fixes f7c913438533 ("io_uring/rw: allow pollable non-blocking attempts for !FMODE_NOWAIT")

---

Thought I had already sent this one out, guess I did not...

io_uring/rw.c +1 -1
index 80ae3c2ebb70..354c4e175654 100644
@@ -807,7 +807,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type)
 	 * reliably. If not, or it IOCB_NOWAIT is set, don't retry.
 	 */
 	if (kiocb->ki_flags & IOCB_NOWAIT ||
-	    ((file->f_flags & O_NONBLOCK && (req->flags & REQ_F_SUPPORT_NOWAIT))))
+	    ((file->f_flags & O_NONBLOCK && !(req->flags & REQ_F_SUPPORT_NOWAIT))))
 		req->flags |= REQ_F_NOWAIT;
 
 	if (ctx->flags & IORING_SETUP_IOPOLL) {
Signature · 1 line
Jens Axboe