Brian Foster eb65540aa9
iomap: warn on zero range of a post-eof folio
iomap_zero_range() uses buffered writes for manual zeroing, no
longer updates i_size for such writes, but is still explicitly
called for post-eof ranges. The historical use case for this is
zeroing post-eof speculative preallocation on extending writes from
XFS. However, XFS also recently changed to convert all post-eof
delalloc mappings to unwritten in the iomap_begin() handler, which
means it now never expects manual zeroing of post-eof mappings. In
other words, all post-eof mappings should be reported as holes or
unwritten.

This is a subtle dependency that can be hard to detect if violated
because associated codepaths are likely to update i_size after folio
locks are dropped, but before writeback happens to occur. For
example, if XFS reverts back to some form of manual zeroing of
post-eof blocks on write extension, writeback of those zeroed folios
will now race with the presumed i_size update from the subsequent
buffered write.

Since iomap_zero_range() can't correctly zero post-eof mappings
beyond EOF without updating i_size, warn if this ever occurs. This
serves as minimal indication that if this use case is reintroduced
by a filesystem, iomap_zero_range() might need to reconsider i_size
updates for write extending use cases.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Link: https://lore.kernel.org/r/20241115145931.535207-1-bfoster@redhat.com
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-11-21 09:35:24 +01:00
..
2024-11-01 07:37:10 -10:00
2024-11-18 16:50:08 -08:00
2024-11-18 09:54:32 -08:00
2024-07-15 11:14:59 -07:00
2024-09-16 09:14:02 +02:00
2024-10-17 00:28:06 -07:00
2024-11-18 10:30:29 -08:00
2024-11-18 09:35:30 -08:00
2024-11-18 18:10:37 -08:00
2024-11-18 09:33:34 -08:00
2024-11-18 09:35:30 -08:00
2024-11-18 10:26:49 -08:00
2024-11-18 09:35:30 -08:00
2024-11-18 09:54:32 -08:00
2024-10-08 10:53:06 -07:00
2024-09-19 10:18:15 +02:00
2024-05-28 11:52:53 +02:00
2024-08-21 22:32:58 +02:00
2024-04-23 13:27:43 +02:00
2024-10-02 12:02:15 -07:00
2024-07-15 11:14:59 -07:00
2024-11-18 09:54:32 -08:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-11-18 10:30:29 -08:00
2024-11-18 10:45:06 -08:00
2024-11-03 01:28:06 -05:00
2024-11-18 09:35:30 -08:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-09-24 15:29:42 -07:00
2024-09-16 11:15:26 +02:00
2024-09-27 08:18:43 -07:00
2024-10-24 13:54:51 +02:00
2024-09-27 08:18:43 -07:00
2024-11-03 01:28:07 -05:00
2024-11-03 01:28:07 -05:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00
2024-11-03 01:28:06 -05:00