aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 6b9aee20f242..83a45d35468b 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -102,9 +102,6 @@
102 * ->inode_lock (zap_pte_range->set_page_dirty) 102 * ->inode_lock (zap_pte_range->set_page_dirty)
103 * ->private_lock (zap_pte_range->__set_page_dirty_buffers) 103 * ->private_lock (zap_pte_range->__set_page_dirty_buffers)
104 * 104 *
105 * ->task->proc_lock
106 * ->dcache_lock (proc_pid_lookup)
107 *
108 * (code doesn't rely on that order, so you could switch it around) 105 * (code doesn't rely on that order, so you could switch it around)
109 * ->tasklist_lock (memory_failure, collect_procs_ao) 106 * ->tasklist_lock (memory_failure, collect_procs_ao)
110 * ->i_mmap_lock 107 * ->i_mmap_lock
@@ -301,7 +298,7 @@ int filemap_fdatawait_range(struct address_space *mapping, loff_t start_byte,
301 continue; 298 continue;
302 299
303 wait_on_page_writeback(page); 300 wait_on_page_writeback(page);
304 if (PageError(page)) 301 if (TestClearPageError(page))
305 ret = -EIO; 302 ret = -EIO;
306 } 303 }
307 pagevec_release(&pvec); 304 pagevec_release(&pvec);
@@ -840,9 +837,6 @@ repeat:
840 if (radix_tree_deref_retry(page)) 837 if (radix_tree_deref_retry(page))
841 goto restart; 838 goto restart;
842 839
843 if (page->mapping == NULL || page->index != index)
844 break;
845
846 if (!page_cache_get_speculative(page)) 840 if (!page_cache_get_speculative(page))
847 goto repeat; 841 goto repeat;
848 842
@@ -852,6 +846,16 @@ repeat:
852 goto repeat; 846 goto repeat;
853 } 847 }
854 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
855 pages[ret] = page; 859 pages[ret] = page;
856 ret++; 860 ret++;
857 index++; 861 index++;
@@ -2223,7 +2227,7 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping,
2223 gfp_notmask = __GFP_FS; 2227 gfp_notmask = __GFP_FS;
2224repeat: 2228repeat:
2225 page = find_lock_page(mapping, index); 2229 page = find_lock_page(mapping, index);
2226 if (likely(page)) 2230 if (page)
2227 return page; 2231 return page;
2228 2232
2229 page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); 2233 page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask);