[lvc-project] [PATCH] lib: free pagelist on error in iov_iter_extract_pages()
Christoph Hellwig
hch at lst.de
Mon May 11 09:35:06 MSK 2026
[adding authors and maintainers of relevant code]
On Fri, May 08, 2026 at 11:33:50AM -0700, Caleb Sander Mateos wrote:
> iov_iter_extract_pages() will only allocate a pages array if the
> initial struct page ** passed is NULL (see want_pages_array()). So the
> condition pages != stack_pages will never be true. Indeed, it looks
> like *all* callers of iov_iter_extract_pages() pass a non-NULL struct
> page **. Would it make sense for iov_iter_extract_pages() to require a
> pre-allocated pages array and remove support for allocating one?
I think the idea was to support this to replace existing users of
iov_iter_get_pages_alloc2. Which is urgently neede as those missing
the proper page pinning support. OTOH we should not keep dead code
around just in case.
For NFS, Pranjal has an initial series to convert away from
iov_iter_get_pages_alloc2, which makes use of the NULL pages argument
to iov_iter_extract_pages.
For 9p, Dominique had an untested patch in December that drops
iov_iter_get_pages_alloc2 in favor of a much better high level approach
that doesn't even involve iov_iter_extract_pages, which seems to not have
made it anywhere. It would be great to get this going again.
net/ceph/ needs to also do work. Not an expert on the code, but given
how it is based off the encryption flag it looks kinda fishy and
iov_iter_extract_pages might not be the best direct replacement.
More information about the lvc-project
mailing list