* [PATCH] io_uring: correct O_NONBLOCK check for splice punt
@ 2020-04-13 3:16 Jens Axboe
2020-04-13 7:21 ` Pavel Begunkov
0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2020-04-13 3:16 UTC (permalink / raw)
To: io-uring; +Cc: Pavel Begunkov
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 <[email protected]>
---
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 68a678a0056b..0d1b5d5f1251 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)
--
Jens Axboe
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] io_uring: correct O_NONBLOCK check for splice punt
2020-04-13 3:16 [PATCH] io_uring: correct O_NONBLOCK check for splice punt Jens Axboe
@ 2020-04-13 7:21 ` Pavel Begunkov
0 siblings, 0 replies; 2+ messages in thread
From: Pavel Begunkov @ 2020-04-13 7:21 UTC (permalink / raw)
To: Jens Axboe, io-uring
On 4/13/2020 6:16 AM, Jens Axboe wrote:
> 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.
My bad, thanks
> Fixes: 7d67af2c0134 ("io_uring: add splice(2) support")
> Signed-off-by: Jens Axboe <[email protected]>
>
> ---
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 68a678a0056b..0d1b5d5f1251 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)
>
--
Pavel Begunkov
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-04-13 7:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-13 3:16 [PATCH] io_uring: correct O_NONBLOCK check for splice punt Jens Axboe
2020-04-13 7:21 ` Pavel Begunkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox