]> git.hungrycats.org Git - linux/commitdiff
[PATCH] hold the page ref across ->readpage
authorAndrew Morton <akpm@digeo.com>
Sun, 15 Sep 2002 15:50:48 +0000 (08:50 -0700)
committerChristoph Hellwig <hch@hera.kernel.org>
Sun, 15 Sep 2002 15:50:48 +0000 (08:50 -0700)
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.

mm/readahead.c

index 209c9813525dd009dfeb14116ee5a029b8985d07..e1e68fc006dcaeb9eeae0d4410a7ea8565dc74f0 100644 (file)
@@ -48,9 +48,9 @@ read_pages(struct file *file, struct address_space *mapping,
                struct page *page = list_entry(pages->prev, struct page, list);
                list_del(&page->list);
                if (!add_to_page_cache(page, mapping, page->index)) {
+                       mapping->a_ops->readpage(file, page);
                        if (!pagevec_add(&lru_pvec, page))
                                __pagevec_lru_add(&lru_pvec);
-                       mapping->a_ops->readpage(file, page);
                } else {
                        page_cache_release(page);
                }