if file->f_flags has O_NONBLOCK, io_file_supports_nowait() returns true which means the if condition in this patch isn't necessary. Signed-off-by: Hao Xu <haoxu@xxxxxxxxxxxxxxxxx> --- fs/io_uring.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/fs/io_uring.c b/fs/io_uring.c index a7412f6862fc..b4dacb5eeecb 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -3034,12 +3034,10 @@ static int io_prep_rw(struct io_kiocb *req, const struct io_uring_sqe *sqe) return ret; /* - * If the file is marked O_NONBLOCK, still allow retry for it if it - * supports async. Otherwise it's impossible to use O_NONBLOCK files - * reliably. If not, or it IOCB_NOWAIT is set, don't retry. + * If the file is marked O_NONBLOCK, still allow retry for it. + * If IOCB_NOWAIT is set, don't retry. */ - if ((kiocb->ki_flags & IOCB_NOWAIT) || - ((file->f_flags & O_NONBLOCK) && !io_file_supports_nowait(req))) + if (kiocb->ki_flags & IOCB_NOWAIT) req->flags |= REQ_F_NOWAIT; if (ctx->flags & IORING_SETUP_IOPOLL) { base-commit: 9e9d83faa9f59266aa772148e32c265c8ad194d3 -- 2.25.1