Skip to content

iomap: zero dirty pages over unwritten extents

Brian Foster linux-fsdevel linux-xfs lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2iomap: use page dirty state to seek data over unwritten extentsfs/iomap/seek.c+3 -28 replies
2/2iomap: zero cached pages over unwritten extents on zero rangefs/iomap/buffered-io.c fs/iomap/seek.c include/linux/iomap.h+40 -36 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] iomap: zero dirty pages over unwritten extents

Hi all,

This is an alternate/iomap based variant of the XFS fix posted here:

https://lore.kernel.org/linux-xfs/[email protected]/

This addresses a post-eof stale data exposure problem that can occur when truncate down races with writeback of the new EOF page and the new EOF block happens to be unwritten. Instead of explicitly flushing the new EOF page in XFS, however, this variant updates iomap zero range to check for and zero preexisting dirty pages over unwritten extents. This reuses the dirty page checking that seek data/hole already implements for unwritten extents. Patch 1 is technically not required, but fixes an odd behavior I noticed when playing around with zero range. Without it, a zero range (with patch 2) over a large, cached (but clean), unwritten mapping would unnecessarily zero pages that aren't otherwise dirty. I don't think this is actually a problem in practice today as most large zero range requests are truncates over post-eof space (which shouldn't have page cache), but it seemed odd regardless.

Thoughts, reviews, flames appreciated.

Brian

Brian Foster (2):
iomap: use page dirty state to seek data over unwritten extents
iomap: zero cached pages over unwritten extents on zero range

 fs/iomap/buffered-io.c | 39 +++++++++++++++++++++++++++++++++++++--
 fs/iomap/seek.c        |  7 ++++---
 include/linux/iomap.h  |  2 ++
 3 files changed, 43 insertions(+), 5 deletions(-)
Signature · 1 line
2.25.4