Commit f3b3dc81 authored by Andrew Morton's avatar Andrew Morton Committed by Christoph Hellwig

[PATCH] hold the page ref across ->readpage

read_pages() is dropping the page refcount before running ->readpage().
Which just happens to work, because the page is in pagecache and
locked.

But it breaks under some unconventional things which reiser4 is doing,
and it's better/safer/saner this way anyway.
parent db748675
...@@ -48,9 +48,9 @@ read_pages(struct file *file, struct address_space *mapping, ...@@ -48,9 +48,9 @@ read_pages(struct file *file, struct address_space *mapping,
struct page *page = list_entry(pages->prev, struct page, list); struct page *page = list_entry(pages->prev, struct page, list);
list_del(&page->list); list_del(&page->list);
if (!add_to_page_cache(page, mapping, page->index)) { if (!add_to_page_cache(page, mapping, page->index)) {
mapping->a_ops->readpage(file, page);
if (!pagevec_add(&lru_pvec, page)) if (!pagevec_add(&lru_pvec, page))
__pagevec_lru_add(&lru_pvec); __pagevec_lru_add(&lru_pvec);
mapping->a_ops->readpage(file, page);
} else { } else {
page_cache_release(page); page_cache_release(page);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment