aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index ca389394fa2a..83a45d35468b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -298,7 +298,7 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
298 continue; 298 continue;
299 299
300 wait_on_page_writeback(page); 300 wait_on_page_writeback(page);
301 if (PageError(page)) 301 if (TestClearPageError(page))
302 ret = -EIO; 302 ret = -EIO;
303 } 303 }
304 pagevec_release(&pvec); 304 pagevec_release(&pvec);
@@ -837,9 +837,6 @@ repeat:
837 if (radix_tree_deref_retry(page)) 837 if (radix_tree_deref_retry(page))
838 goto restart; 838 goto restart;
839 839
840 if (page->mapping == NULL || page->index != index)
841 break;
842
843 if (!page_cache_get_speculative(page)) 840 if (!page_cache_get_speculative(page))
844 goto repeat; 841 goto repeat;
845 842
@@ -849,6 +846,16 @@ repeat:
849 goto repeat; 846 goto repeat;
850 } 847 }
851 848
849 /*
850 * must check mapping and index after taking the ref.
851 * otherwise we can get both false positives and false
852 * negatives, which is just confusing to the caller.
853 */
854 if (page->mapping == NULL || page->index != index) {
855 page_cache_release(page);
856 break;
857 }
858
852 pages[ret] = page; 859 pages[ret] = page;
853 ret++; 860 ret++;
854 index++; 861 index++;
@@ -2220,7 +2227,7 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping,
2220 gfp_notmask = __GFP_FS; 2227 gfp_notmask = __GFP_FS;
2221repeat: 2228repeat:
2222 page = find_lock_page(mapping, index); 2229 page = find_lock_page(mapping, index);
2223 if (likely(page)) 2230 if (page)
2224 return page; 2231 return page;
2225 2232
2226 page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); 2233 page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask);