Re: [PATCH v2 4/7] iov_iter: new iov_iter_pin_pages*() routines

Christoph Hellwig
2022-09-22T14:32:24Z

On Wed, Sep 14, 2022 at 04:51:17AM +0100, Al Viro wrote:
> Unless I'm misreading Jan, the question is whether they should get or
> pin.

And I think the answer is: inside ->read_iter or ->write_iter they
should neither get or pin. The callers of it need to pin the pages
if they are pagecache pages that can potentially be written to through
shared mappings, else a get would be enough. But the method instance
should not have to care and just be able to rely on the caller making
sure they do not go away.

> I'm really tempted to slap
> if (WARN_ON(i->data_source))
> return 0;
> into copy_to_iter() et.al., along with its opposite for copy_from_iter().

Ys, I think that would be useful. And we could use something more
descriptive than READ/WRITE to start with.