The patch titled FS-Cache: Release page->private in failed readahead has been removed from the -mm tree. Its filename was fs-cache-release-page-private-in-failed-readahead.patch This patch was dropped because it is obsolete ------------------------------------------------------ Subject: FS-Cache: Release page->private in failed readahead From: David Howells <dhowells@xxxxxxxxxx> The attached patch causes read_cache_pages() to release page-private data on a page for which add_to_page_cache() fails or the filler function fails. This permits pages with caching references associated with them to be cleaned up. Further changes [try #9] that have been made: (*) The try_to_release_page() is called instead of calling the releasepage() op directly. (*) The page is locked before try_to_release_page() is called. (*) The call to try_to_release_page() and page_cache_release() have been abstracted out into a helper function as this bit of code occurs twice.. Further changes [try #10] that have been made: (*) The comment header on the helper function is much expanded. This states why there's a need to call the releasepage() op in the event of an error. (*) BUG() if the page is already locked when we try and lock it. (*) Don't set the page mapping pointer until we've locked the page. (*) The page is unlocked after try_to_release_page() is called. Signed-off-by: David Howells <dhowells@xxxxxxxxxx> Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- mm/readahead.c | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletion(-) diff -puN mm/readahead.c~fs-cache-release-page-private-in-failed-readahead mm/readahead.c --- a/mm/readahead.c~fs-cache-release-page-private-in-failed-readahead +++ a/mm/readahead.c @@ -14,6 +14,7 @@ #include <linux/blkdev.h> #include <linux/backing-dev.h> #include <linux/pagevec.h> +#include <linux/buffer_head.h> void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) { @@ -118,6 +119,26 @@ static inline unsigned long get_next_ra_ #define list_to_page(head) (list_entry((head)->prev, struct page, lru)) +/* + * see if a page needs releasing upon read_cache_pages() failure + * - the caller of read_cache_pages() may have set PG_private before calling, + * such as the NFS fs marking pages that are cached locally on disk, thus we + * need to give the fs a chance to clean up in the event of an error + */ +static void read_cache_pages_release_page(struct address_space *mapping, + struct page *page) +{ + if (PagePrivate(page)) { + if (TestSetPageLocked(page)) + BUG(); + page->mapping = mapping; + try_to_release_page(page, GFP_KERNEL); + page->mapping = NULL; + unlock_page(page); + } + page_cache_release(page); +} + /** * read_cache_pages - populate an address space with some pages & start reads against them * @mapping: the address_space @@ -141,7 +162,7 @@ int read_cache_pages(struct address_spac page = list_to_page(pages); list_del(&page->lru); if (add_to_page_cache(page, mapping, page->index, GFP_KERNEL)) { - page_cache_release(page); + read_cache_pages_release_page(mapping, page); continue; } ret = filler(data, page); _ Patches currently in -mm which might be from dhowells@xxxxxxxxxx are origin.patch nfs-represent-64-bit-fileids-as-64-bit-inode-numbers-on-32-bit-systems.patch security-keys-user-kmemdup.patch log2-implement-a-general-integer-log2-facility-in-the-kernel.patch log2-implement-a-general-integer-log2-facility-in-the-kernel-fix.patch log2-implement-a-general-integer-log2-facility-in-the-kernel-vs-git-cryptodev.patch log2-implement-a-general-integer-log2-facility-in-the-kernel-ppc-fix.patch log2-alter-roundup_pow_of_two-so-that-it-can-use-a-ilog2-on-a-constant.patch log2-alter-get_order-so-that-it-can-make-use-of-ilog2-on-a-constant.patch log2-provide-ilog2-fallbacks-for-powerpc.patch fs-cache-release-page-private-in-failed-readahead.patch fs-cache-release-page-private-after-failed-readahead-12.patch fs-cache-make-kafs-use-fs-cache.patch fs-cache-make-kafs-use-fs-cache-fix.patch fs-cache-make-kafs-use-fs-cache-12.patch fs-cache-make-kafs-use-fs-cache-12-fix.patch fs-cache-make-kafs-use-fs-cache-kconfig-fix.patch fs-cache-make-kafs-use-fs-cache-vs-streamline-generic_file_-interfaces-and-filemap.patch nfs-use-local-caching.patch nfs-use-local-caching-12.patch nfs-use-local-caching-12-fix.patch nfs-use-local-caching-kconfig-fix.patch nfs-use-local-caching-configh.patch add-missing-page_copy-export-for-ppc-and-powerpc.patch fs-cache-cachefiles-ia64-missing-copy_page-export.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-fscache-fix-gfp_t-sparse-annotations.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-cachefiles-printk-format-warning.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-warning-fixes.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-cachefiles-cachefiles_write_page-shouldnt-indicate-error-twice.patch fscache-kconfig-tidying.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-log2-fix.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-cachefiles-handle-enospc-on-create-mkdir-better.patch fs-cache-cachefiles-a-cache-that-backs-onto-a-mounted-filesystem-inode-count-maintenance.patch afs-amend-the-afs-configuration-options.patch reiser4-get_sb_dev-fix.patch mutex-subsystem-synchro-test-module.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html