diff options
Diffstat (limited to 'mm/truncate.c')
-rw-r--r-- | mm/truncate.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mm/truncate.c b/mm/truncate.c index f47e46d1be3b..aed85f0b707f 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -192,6 +192,11 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
192 | unlock_page(page); | 192 | unlock_page(page); |
193 | continue; | 193 | continue; |
194 | } | 194 | } |
195 | if (page_mapped(page)) { | ||
196 | unmap_mapping_range(mapping, | ||
197 | (loff_t)page_index<<PAGE_CACHE_SHIFT, | ||
198 | PAGE_CACHE_SIZE, 0); | ||
199 | } | ||
195 | truncate_complete_page(mapping, page); | 200 | truncate_complete_page(mapping, page); |
196 | unlock_page(page); | 201 | unlock_page(page); |
197 | } | 202 | } |
@@ -229,6 +234,11 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
229 | break; | 234 | break; |
230 | lock_page(page); | 235 | lock_page(page); |
231 | wait_on_page_writeback(page); | 236 | wait_on_page_writeback(page); |
237 | if (page_mapped(page)) { | ||
238 | unmap_mapping_range(mapping, | ||
239 | (loff_t)page->index<<PAGE_CACHE_SHIFT, | ||
240 | PAGE_CACHE_SIZE, 0); | ||
241 | } | ||
232 | if (page->index > next) | 242 | if (page->index > next) |
233 | next = page->index; | 243 | next = page->index; |
234 | next++; | 244 | next++; |
@@ -405,7 +415,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping, | |||
405 | break; | 415 | break; |
406 | } | 416 | } |
407 | wait_on_page_writeback(page); | 417 | wait_on_page_writeback(page); |
408 | while (page_mapped(page)) { | 418 | if (page_mapped(page)) { |
409 | if (!did_range_unmap) { | 419 | if (!did_range_unmap) { |
410 | /* | 420 | /* |
411 | * Zap the rest of the file in one hit. | 421 | * Zap the rest of the file in one hit. |
@@ -425,6 +435,7 @@ int invalidate_inode_pages2_range(struct address_space *mapping, | |||
425 | PAGE_CACHE_SIZE, 0); | 435 | PAGE_CACHE_SIZE, 0); |
426 | } | 436 | } |
427 | } | 437 | } |
438 | BUG_ON(page_mapped(page)); | ||
428 | ret = do_launder_page(mapping, page); | 439 | ret = do_launder_page(mapping, page); |
429 | if (ret == 0 && !invalidate_complete_page2(mapping, page)) | 440 | if (ret == 0 && !invalidate_complete_page2(mapping, page)) |
430 | ret = -EIO; | 441 | ret = -EIO; |