Commit 2fb3e822 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

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: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 4ee36314
...@@ -2768,15 +2768,6 @@ static int io_splice_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -2768,15 +2768,6 @@ static int io_splice_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
return 0; 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) static int io_splice(struct io_kiocb *req, bool force_nonblock)
{ {
struct io_splice *sp = &req->splice; struct io_splice *sp = &req->splice;
...@@ -2786,11 +2777,8 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock) ...@@ -2786,11 +2777,8 @@ static int io_splice(struct io_kiocb *req, bool force_nonblock)
loff_t *poff_in, *poff_out; loff_t *poff_in, *poff_out;
long ret; long ret;
if (force_nonblock) { if (force_nonblock)
if (io_splice_punt(in, READ) || io_splice_punt(out, WRITE))
return -EAGAIN; return -EAGAIN;
flags |= SPLICE_F_NONBLOCK;
}
poff_in = (sp->off_in == -1) ? NULL : &sp->off_in; poff_in = (sp->off_in == -1) ? NULL : &sp->off_in;
poff_out = (sp->off_out == -1) ? NULL : &sp->off_out; poff_out = (sp->off_out == -1) ? NULL : &sp->off_out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment