Skip to content

Commit

Permalink
[GFS2] Bug fix to gfs2_readpages()
Browse files Browse the repository at this point in the history
This fixes a bug where we were releasing a page incorrectly
sometimes when reading a stuffed file. This fixes the bug
that Kevin reported when using Xen.

Cc: Kevin Anderson <kanderso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
  • Loading branch information
Steven Whitehouse committed Jul 10, 2006
1 parent dc3e130 commit ffeb874
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fs/gfs2/ops_address.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ static int gfs2_readpage(struct file *file, struct page *page)
goto out;
}

#define list_to_page(head) (list_entry((head)->prev, struct page, lru))

/**
* gfs2_readpages - Read a bunch of pages at once
*
Expand Down Expand Up @@ -290,16 +288,18 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,
struct pagevec lru_pvec;
pagevec_init(&lru_pvec, 0);
for (page_idx = 0; page_idx < nr_pages; page_idx++) {
struct page *page = list_to_page(pages);
struct page *page = list_entry(pages->prev, struct page, lru);
prefetchw(&page->flags);
list_del(&page->lru);
if (!add_to_page_cache(page, mapping,
page->index, GFP_KERNEL)) {
ret = stuffed_readpage(ip, page);
unlock_page(page);
if (!pagevec_add(&lru_pvec, page))
__pagevec_lru_add(&lru_pvec);
} else {
page_cache_release(page);
}
page_cache_release(page);
}
pagevec_lru_add(&lru_pvec);
ret = 0;
Expand All @@ -321,7 +321,7 @@ static int gfs2_readpages(struct file *file, struct address_space *mapping,
out_unlock:
/* unlock all pages, we can't do any I/O right now */
for (page_idx = 0; page_idx < nr_pages; page_idx++) {
struct page *page = list_to_page(pages);
struct page *page = list_entry(pages->prev, struct page, lru);
list_del(&page->lru);
unlock_page(page);
page_cache_release(page);
Expand Down

0 comments on commit ffeb874

Please sign in to comment.