Skip to content

Commit

Permalink
io_uring: punt splice async because of inode mutex
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
isilence authored and axboe committed May 1, 2020
1 parent 4ee3631 commit 2fb3e82
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 2fb3e82

Please sign in to comment.