]> git.baikalelectronics.ru Git - kernel.git/commit
fs/iomap: Fix buffered write page prefaulting
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Nov 2021 11:56:06 +0000 (12:56 +0100)
committerAndreas Gruenbacher <agruenba@redhat.com>
Fri, 25 Mar 2022 14:14:03 +0000 (15:14 +0100)
commitb2cb8f32a25ecdfe5dac56652e10641a3a58f021
tree4d35c6076638ba43441cebfecdc96a08c6dee343
parentd41990bd103245f945b3435aaa7371fa1c21d677
fs/iomap: Fix buffered write page prefaulting

When part of the user buffer passed to generic_perform_write() or
iomap_file_buffered_write() cannot be faulted in for reading, the entire
write currently fails.  The correct behavior would be to write all the
data that can be written, up to the point of failure.

Commit 0025de2cd74f ("iov_iter: Turn iov_iter_fault_in_readable into
fault_in_iov_iter_readable") gave us the information needed, so fix the
page prefaulting in generic_perform_write() and iomap_write_iter() to
only bail out when no pages could be faulted in.

We already factor in that pages that are faulted in may no longer be
resident by the time they are accessed.  Paging out pages has the same
effect as not faulting in those pages in the first place, so the code
can already deal with that.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/iomap/buffered-io.c
mm/filemap.c