summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2020-05-01 17:09:38 +0300
committerJens Axboe <axboe@kernel.dk>2020-05-01 17:50:57 +0300
commit2fb3e82284fca40afbde5351907f0a5b3be717f9 (patch)
treef373b9b6706caa213245c7131d286f34e6000361
parent4ee3631451c9a62e6b6bc7ee51fb9a5b34e33509 (diff)
downloadlinux-2fb3e82284fca40afbde5351907f0a5b3be717f9.tar.xz
io_uring: punt splice async because of inode mutex
Nonblocking do_splice() still may wait for some time on an inode mutex. Let's play safe and always punt it async. Reported-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 91ddc27b5173..0b91b0631173 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -2768,15 +2768,6 @@ static int io_splice_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
return 0;
}
-static bool io_splice_punt(struct file *file, int rw)
-{
- if (get_pipe_info(file))
- return false;
- if (!io_file_supports_async(file, rw))
- return true;
- return !(file->f_flags & O_NONBLOCK);
-}
-
static int io_splice(struct io_kiocb *req, bool force_nonblock)
{
struct io_splice *sp = &req->splice;
@@ -2786,11 +2777,8 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock)
loff_t *poff_in, *poff_out;
long ret;
- if (force_nonblock) {
- if (io_splice_punt(in, READ) || io_splice_punt(out, WRITE))
- return -EAGAIN;
- flags |= SPLICE_F_NONBLOCK;
- }
+ if (force_nonblock)
+ return -EAGAIN;
poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;