Make block-bio use pinning
block: convert bio_map_user_iov to use iov_iter_extract_pages

This will pin pages or leave them unaltered rather than getting a ref on
them as appropriate to the iterator.

The pages need to be pinned for DIO rather than having refs taken on them
to prevent VM copy-on-write from malfunctioning during a concurrent fork()
(the result of the I/O could otherwise end up being visible to/affected by
the child process).

Signed-off-by: David Howells <>
Reviewed-by: Christoph Hellwig <>
Reviewed-by: John Hubbard <>
cc: Al Viro <>
cc: Jens Axboe <>
cc: Jan Kara <>
cc: Matthew Wilcox <>
cc: Logan Gunthorpe <>
1 file changed