When read from a regular file that was opened O_NONBLOCK, it will return EAGAIN if the page is not cached, which is not expected and fails the application. Applications written before expect that the open flag O_NONBLOCK has no effect on a regular file. Fix this by not setting REQ_F_NOWAIT for regular files. Signed-off-by: Jiufei Xue <jiufei.xue@xxxxxxxxxxxxxxxxx> --- fs/io_uring.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index 95df63b..69db8bb 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2107,7 +2107,7 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe, /* don't allow async punt if RWF_NOWAIT was requested */ if ((kiocb->ki_flags & IOCB_NOWAIT) || - (req->file->f_flags & O_NONBLOCK)) + (!(req->flags & REQ_F_ISREG) && (req->file->f_flags & O_NONBLOCK))) req->flags |= REQ_F_NOWAIT; if (force_nonblock) -- 1.8.3.1