linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Fix readahead_page_batch for retry entries
@ 2020-11-03 14:28 Matthew Wilcox (Oracle)
  2020-11-04  1:10 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox (Oracle) @ 2020-11-03 14:28 UTC (permalink / raw)
  To: Andrew Morton, linux-fsdevel; +Cc: Matthew Wilcox, David Sterba, Wonhyuk Yang

Both btrfs and fuse have reported faults caused by seeing a retry
entry instead of the page they were looking for.  This was caused
by a missing check in the iterator.

Reported-by: David Sterba <dsterba@suse.com>
Reported-by: Wonhyuk Yang <vvghjk1234@gmail.com>
Fixes: 042124cc64c3 ("mm: add new readahead_control API")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index b921581a7dcf..2ea741c2bb16 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -751,6 +751,8 @@ static inline unsigned int __readahead_batch(struct readahead_control *rac,
 	xas_set(&xas, rac->_index);
 	rcu_read_lock();
 	xas_for_each(&xas, page, rac->_index + rac->_nr_pages - 1) {
+		if (xas_retry(&xas, page))
+			continue;
 		VM_BUG_ON_PAGE(!PageLocked(page), page);
 		VM_BUG_ON_PAGE(PageTail(page), page);
 		array[i++] = page;

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

end of thread, other threads:[~2020-11-05  2:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-03 14:28 [PATCH] mm: Fix readahead_page_batch for retry entries Matthew Wilcox (Oracle)
2020-11-04  1:10 ` Andrew Morton
2020-11-04 14:27   ` David Sterba
2020-11-05  2:33   ` Wonhyuk Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).