Skip to content

Commit ae6a888

Browse files
committed
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. Reported-by: Julian Orth <[email protected]> Link: axboe/liburing#1270 Fixes: f7c9134 ("io_uring/rw: allow pollable non-blocking attempts for !FMODE_NOWAIT") Signed-off-by: Jens Axboe <[email protected]>
1 parent 8f7033a commit ae6a888

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

io_uring/rw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode, int rw_type)
807807
* reliably. If not, or it IOCB_NOWAIT is set, don't retry.
808808
*/
809809
if (kiocb->ki_flags & IOCB_NOWAIT ||
810-
((file->f_flags & O_NONBLOCK && (req->flags & REQ_F_SUPPORT_NOWAIT))))
810+
((file->f_flags & O_NONBLOCK && !(req->flags & REQ_F_SUPPORT_NOWAIT))))
811811
req->flags |= REQ_F_NOWAIT;
812812

813813
if (ctx->flags & IORING_SETUP_IOPOLL) {

0 commit comments

Comments
 (0)