Message ID | 20230520000049.2226926-7-dhowells@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | splice: Kill ITER_PIPE | expand |
On Sat, May 20, 2023 at 01:00:25AM +0100, David Howells wrote: > Make vfs_splice_read() return immediately if the length is 0. > > Signed-off-by: David Howells <dhowells@redhat.com> > cc: Christoph Hellwig <hch@lst.de> > cc: Jens Axboe <axboe@kernel.dk> > cc: Al Viro <viro@zeniv.linux.org.uk> > cc: linux-block@vger.kernel.org > cc: linux-fsdevel@vger.kernel.org > cc: linux-mm@kvack.org > --- Reviewed-by: Christian Brauner <brauner@kernel.org>
diff --git a/fs/splice.c b/fs/splice.c index d815a69f6589..fe3309ffeb26 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -891,6 +891,8 @@ long vfs_splice_read(struct file *in, loff_t *ppos, if (unlikely(!(in->f_mode & FMODE_READ))) return -EBADF; + if (!len) + return 0; /* Don't try to read more the pipe has space for. */ p_space = pipe->max_usage - pipe_occupancy(pipe->head, pipe->tail);
Make vfs_splice_read() return immediately if the length is 0. Signed-off-by: David Howells <dhowells@redhat.com> cc: Christoph Hellwig <hch@lst.de> cc: Jens Axboe <axboe@kernel.dk> cc: Al Viro <viro@zeniv.linux.org.uk> cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/splice.c | 2 ++ 1 file changed, 2 insertions(+)