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@xxxxxxxx> Reported-by: Wonhyuk Yang <vvghjk1234@xxxxxxxxx> Fixes: 042124cc64c3 ("mm: add new readahead_control API") Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> 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;