Re: [PATCH 2/2] fs: kill add_to_page_cache_locked()

From: Matthew Wilcox
Date: Mon Oct 19 2020 - 15:13:09 EST


On Mon, Oct 19, 2020 at 02:59:11PM -0400, Kent Overstreet wrote:
> @@ -885,29 +886,30 @@ static int __add_to_page_cache_locked(struct page *page,
> page->mapping = NULL;
> /* Leave page->index set: truncation relies upon it */
> put_page(page);
> + __ClearPageLocked(page);
> return error;
> }
> -ALLOW_ERROR_INJECTION(__add_to_page_cache_locked, ERRNO);

I think you're missing:

+ALLOW_ERROR_INJECTION(__add_to_page_cache, ERRNO);

I see this:
> +int add_to_page_cache(struct page *page, struct address_space *mapping,
> + pgoff_t offset, gfp_t gfp_mask)
> {
> - return __add_to_page_cache_locked(page, mapping, offset,
> - gfp_mask, NULL);
> + return __add_to_page_cache(page, mapping, offset, gfp_mask, NULL);
> }
> -EXPORT_SYMBOL(add_to_page_cache_locked);
> +EXPORT_SYMBOL(add_to_page_cache);
> +ALLOW_ERROR_INJECTION(add_to_page_cache, ERRNO);

but I think that's insufficient because most calls are to
add_to_page_cache_lru(), which doesn't have an error injection point.

By the way, that CIFS code is going to go away with the fscache rewrite.