Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 230706
b: refs/heads/master
c: 9cbb4cb
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Jan 14, 2011
1 parent b873f8a commit f445023
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f0bc0a60b13f209df16062f94e9fb4b90dc08708
refs/heads/master: 9cbb4cb21b19fff46cf1174d0ed699ef710e641c
13 changes: 10 additions & 3 deletions trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,9 +837,6 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
if (radix_tree_deref_retry(page))
goto restart;

if (page->mapping == NULL || page->index != index)
break;

if (!page_cache_get_speculative(page))
goto repeat;

Expand All @@ -849,6 +846,16 @@ unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index,
goto repeat;
}

/*
* must check mapping and index after taking the ref.
* otherwise we can get both false positives and false
* negatives, which is just confusing to the caller.
*/
if (page->mapping == NULL || page->index != index) {
page_cache_release(page);
break;
}

pages[ret] = page;
ret++;
index++;
Expand Down

0 comments on commit f445023

Please sign in to comment.