From: Trond Myklebust Date: Sat, 13 Jan 2007 02:28:13 -0500 VM: invalidate_inode_pages2_range() shouldn't fail on page dirty... invalidate_inode_pages2() should not try to fix races between direct_IO and mmap(). It should only be trying to clear out pages that were dirty before the direct_IO write (see generic_file_direct_IO()). Skipping dirty pages should therefore not result in an error. Signed-off-by: Trond Myklebust --- mm/truncate.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/truncate.c b/mm/truncate.c index b02fe53..2668df9 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -323,6 +323,8 @@ EXPORT_SYMBOL(invalidate_inode_pages); * invalidation guarantees, and cannot afford to leave pages behind because * shrink_list() has a temp ref on them, or because they're transiently sitting * in the lru_cache_add() pagevecs. + * Note: this function just skips pages that are dirty without flagging + * an error. */ static int invalidate_complete_page2(struct address_space *mapping, struct page *page) @@ -335,7 +337,7 @@ invalidate_complete_page2(struct address write_lock_irq(&mapping->tree_lock); if (PageDirty(page)) - goto failed; + goto dirty; BUG_ON(PagePrivate(page)); __remove_from_page_cache(page); @@ -343,9 +345,9 @@ invalidate_complete_page2(struct address ClearPageUptodate(page); page_cache_release(page); /* pagecache ref */ return 1; -failed: +dirty: write_unlock_irq(&mapping->tree_lock); - return 0; + return 1; } static int do_launder_page(struct address_space *mapping, struct page *page)