All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iomap: Set all uptodate bits for an Uptodate page
@ 2020-09-24 12:56 Matthew Wilcox (Oracle)
  2020-09-24 13:12 ` Brian Foster
                   ` (3 more replies)
  0 siblings, 4 replies; 43+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-09-24 12:56 UTC (permalink / raw)
  To: linux-xfs, linux-fsdevel
  Cc: Matthew Wilcox (Oracle),
	Darrick J. Wong, Christoph Hellwig, Qian Cai, Brian Foster

For filesystems with block size < page size, we need to set all the
per-block uptodate bits if the page was already uptodate at the time
we create the per-block metadata.  This can happen if the page is
invalidated (eg by a write to drop_caches) but ultimately not removed
from the page cache.

This is a data corruption issue as page writeback skips blocks which
are marked !uptodate.

Fixes: 9dc55f1389f9 ("iomap: add support for sub-pagesize buffered I/O without buffer heads")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reported-by: Qian Cai <cai@redhat.com>
Cc: Brian Foster <bfoster@redhat.com>
---
 fs/iomap/buffered-io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
index 8b6cca7e34e4..8180061b9e16 100644
--- a/fs/iomap/buffered-io.c
+++ b/fs/iomap/buffered-io.c
@@ -60,6 +60,8 @@ iomap_page_create(struct inode *inode, struct page *page)
 	iop = kzalloc(struct_size(iop, uptodate, BITS_TO_LONGS(nr_blocks)),
 			GFP_NOFS | __GFP_NOFAIL);
 	spin_lock_init(&iop->uptodate_lock);
+	if (PageUptodate(page))
+		bitmap_fill(iop->uptodate, nr_blocks);
 	attach_page_private(page, iop);
 	return iop;
 }
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2020-10-04 10:35 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-24 12:56 [PATCH] iomap: Set all uptodate bits for an Uptodate page Matthew Wilcox (Oracle)
2020-09-24 13:12 ` Brian Foster
2020-09-24 13:59   ` Matthew Wilcox
2020-09-24 14:47     ` Gao Xiang
2020-09-24 15:12     ` Brian Foster
2020-09-24 15:22       ` Matthew Wilcox
2020-09-24 17:26         ` Brian Foster
2020-09-24 17:56           ` Matthew Wilcox
2020-09-24 15:08 ` Sedat Dilek
2020-09-24 15:15   ` Matthew Wilcox
2020-09-24 15:21     ` Sedat Dilek
2020-09-24 15:27       ` Matthew Wilcox
2020-09-24 16:19         ` Sedat Dilek
2020-09-24 16:36           ` Matthew Wilcox
2020-09-24 18:27             ` Sedat Dilek
2020-09-24 18:44               ` Matthew Wilcox
2020-09-24 18:47               ` Qian Cai
2020-09-24 19:54                 ` Sedat Dilek
2020-09-24 20:02                   ` Matthew Wilcox
2020-09-24 20:04                     ` Sedat Dilek
2020-09-24 23:57                       ` Matthew Wilcox
2020-09-25  2:13                         ` Sedat Dilek
2020-09-25 10:44                         ` Sedat Dilek
2020-09-25 11:12                           ` Sedat Dilek
2020-09-25 13:24                         ` Sedat Dilek
2020-09-25 13:36                           ` Sedat Dilek
2020-09-25 13:46                             ` Matthew Wilcox
2020-09-25 14:01                               ` Sedat Dilek
2020-09-25 15:53                                 ` Matthew Wilcox
2020-09-26 19:12                                   ` Sedat Dilek
2020-09-27 11:31                                   ` Sedat Dilek
2020-09-27 12:04                                     ` Matthew Wilcox
2020-09-27 12:34                                       ` Sedat Dilek
2020-09-27 12:45                                         ` Sedat Dilek
2020-09-27 13:48                                       ` Sedat Dilek
2020-09-27 13:54                                         ` Matthew Wilcox
2020-09-27 14:02                                           ` Sedat Dilek
2020-09-27 15:19                                             ` Sedat Dilek
2020-10-03 18:52                         ` Sedat Dilek
2020-10-04  4:13                           ` Matthew Wilcox
2020-10-04 10:35                             ` Sedat Dilek
2020-09-25 18:17 ` Darrick J. Wong
2020-09-28  6:41 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.