From: OGAWA Hirofumi Current read_pages() assume ->readpages() frees the passed pages. This patch free the pages in ->read_pages(), if those were remaining in the pages_list. So, readpages() just can ignore the remaining pages in pages_list. Signed-off-by: OGAWA Hirofumi Cc: Steven French Cc: Miklos Szeredi Cc: Steven Whitehouse Cc: Trond Myklebust Signed-off-by: Andrew Morton --- mm/readahead.c | 2 ++ 1 file changed, 2 insertions(+) diff -puN mm/readahead.c~cleanup-read_pages mm/readahead.c --- a/mm/readahead.c~cleanup-read_pages +++ a/mm/readahead.c @@ -167,6 +167,8 @@ static int read_pages(struct address_spa if (mapping->a_ops->readpages) { ret = mapping->a_ops->readpages(filp, mapping, pages, nr_pages); + /* Clean up the remaining pages */ + put_pages_list(pages); goto out; } _