Issuing more reads on errors is not a good idea, especially when the most common error here is -ENOMEM.
Signed-off-by: Christoph Hellwig <[email protected]> --- fs/verity/pagecache.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/verity/pagecache.c b/fs/verity/pagecache.c index 01c652bc802f..1a88decace53 100644 --- a/fs/verity/pagecache.c +++ b/fs/verity/pagecache.c @@ -22,7 +22,8 @@ struct page *generic_read_merkle_tree_page(struct inode *inode, pgoff_t index, struct folio *folio; folio = __filemap_get_folio(inode->i_mapping, index, FGP_ACCESSED, 0); - if (IS_ERR(folio) || !folio_test_uptodate(folio)) { + if (folio == ERR_PTR(-ENOENT) || + (!IS_ERR(folio) && !folio_test_uptodate(folio))) { DEFINE_READAHEAD(ractl, NULL, NULL, inode->i_mapping, index); if (!IS_ERR(folio)) @@ -30,9 +31,9 @@ struct page *generic_read_merkle_tree_page(struct inode *inode, pgoff_t index, else if (num_ra_pages > 1) page_cache_ra_unbounded(&ractl, num_ra_pages, 0); folio = read_mapping_folio(inode->i_mapping, index, NULL); - if (IS_ERR(folio)) - return ERR_CAST(folio); } + if (IS_ERR(folio)) + return ERR_CAST(folio); return folio_file_page(folio, index); } EXPORT_SYMBOL_GPL(generic_read_merkle_tree_page); -- 2.47.3 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
