[11/16] iomap: Don't mark partial pages zeroing uptodate for zero-around
diff mbox series

Message ID 20181107063127.3902-12-david@fromorbit.com
State New
Headers show
  • xfs: Block size > PAGE_SIZE support
Related show

Commit Message

Dave Chinner Nov. 7, 2018, 6:31 a.m. UTC
From: Dave Chinner <dchinner@redhat.com>

When zero-around stops short of a full block, such as when zeroing
to a new EOF, iomap_zero() triggers the partial page read code in

Because we are over an unmapped range, the code will zero the
portion that we would have read and then marks the page up to date.
Unfortunately, this defeats the zero-around code that looks for
pages that are not up to date for zeroing, and hence the zero-around
fails to zero the "unread" portion of the page and exposes stale

Hence if we are doing read-around and we zero a partial page, do
not mark it up to date so that the zero-around will zero the
remaining section of the page.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
 fs/iomap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/fs/iomap.c b/fs/iomap.c
index d572e57c5caa..41922fc775c4 100644
--- a/fs/iomap.c
+++ b/fs/iomap.c
@@ -592,7 +592,13 @@  iomap_read_page_sync(struct inode *inode, loff_t block_start, struct page *page,
 	if (iomap->type != IOMAP_MAPPED || block_start >= i_size_read(inode)) {
 		zero_user_segments(page, poff, from, to, poff + plen);
-		iomap_set_range_uptodate(page, poff, plen);
+		/*
+		 * if this is zero-around, we don't want to mark the page
+		 * uptodate here  because this is only a partial page zeroing
+		 * and there's still more data to be written into the page.
+		 */
+		if (!(iomap->flags & IOMAP_F_ZERO_AROUND))
+			iomap_set_range_uptodate(page, poff, plen);
 		return 0;