Re: [PATCH v6 20/34] vfs: Make splice use iov_iter_extract_pages()

From: Al Viro
Date: Wed Jan 18 2023 - 21:32:07 EST


On Mon, Jan 16, 2023 at 11:10:25PM +0000, David Howells wrote:

> diff --git a/fs/splice.c b/fs/splice.c
> index 19c5b5adc548..c3433266ba1b 100644
> --- a/fs/splice.c
> +++ b/fs/splice.c
> @@ -1159,14 +1159,18 @@ static int iter_to_pipe(struct iov_iter *from,
> size_t total = 0;
> int ret = 0;
>
> + /* For the moment, all pages attached to a pipe must have refs, not pins. */
> + if (WARN_ON(iov_iter_extract_mode(from, FOLL_SOURCE_BUF) != FOLL_GET))
> + return -EIO;

Huh? WTF does that have to do with pins? Why would we be pinning the _source_
pages anyway? We do want them referenced, for obvious reasons (they might be
stuck in the pipe), but that has nothing to do with get vs. pin.

If anything, this is one place where we want the semantics of iov_iter_get_pages...