From 874faab1f9289bd097e79f09a8abdf39d1f90198 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Sun, 12 Apr 2020 21:12:49 -0600 Subject: [PATCH 1333/2944] io_uring: correct O_NONBLOCK check for splice punt to #28170604 commit 88357580854aab29d27e1a443575caaedd081612 upstream The splice file punt check uses file->f_mode to check for O_NONBLOCK, but it should be checking file->f_flags. This leads to punting even for files that have O_NONBLOCK set, which isn't necessary. This equates to checking for FMODE_PATH, which will never be set on the fd in question. Fixes: 7d67af2c0134 ("io_uring: add splice(2) support") Signed-off-by: Jens Axboe Acked-by: Joseph Qi Signed-off-by: Xiaoguang Wang --- 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 5db3e04..a7a0148 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -2763,7 +2763,7 @@ static bool io_splice_punt(struct file *file) return false; if (!io_file_supports_async(file)) return true; - return !(file->f_mode & O_NONBLOCK); + return !(file->f_flags & O_NONBLOCK); } static int io_splice(struct io_kiocb *req, bool force_nonblock) -- 1.8.3.1