The patch titled fix invalidate_inode_pages2_range() to not clear ret has been added to the -mm tree. Its filename is fix-invalidate_inode_pages2_range-to-not-clear-ret.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: fix invalidate_inode_pages2_range() to not clear ret From: Hisashi Hifumi <hifumi.hisashi@xxxxxxxxxxxxx> DIO invalidates page cache through invalidate_inode_pages2_range(). invalidate_inode_pages2_range() sets ret=-EIO when invalidate_complete_page2() fails, but this ret is cleared if do_launder_page() succeed on a page of next index. In this case, dio is carried out even if invalidate_complete_page2() fails on some pages. This can cause inconsistency between memory and blocks on HDD because the page cache still exists. Signed-off-by: Hisashi Hifumi <hifumi.hisashi@xxxxxxxxxxxxx> Cc: Badari Pulavarty <pbadari@xxxxxxxxxx> Cc: Ken Chen <kenchen@xxxxxxxxxx> Cc: Zach Brown <zach.brown@xxxxxxxxxx> Cc: Nick Piggin <nickpiggin@xxxxxxxxxxxx> Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxx> Cc: "J. Bruce Fields" <bfields@xxxxxxxxxxxx> Cc: Chuck Lever <cel@xxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/truncate.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff -puN mm/truncate.c~fix-invalidate_inode_pages2_range-to-not-clear-ret mm/truncate.c --- a/mm/truncate.c~fix-invalidate_inode_pages2_range-to-not-clear-ret +++ a/mm/truncate.c @@ -392,6 +392,7 @@ int invalidate_inode_pages2_range(struct pgoff_t next; int i; int ret = 0; + int ret2 = 0; int did_range_unmap = 0; int wrapped = 0; @@ -439,9 +440,11 @@ int invalidate_inode_pages2_range(struct } } BUG_ON(page_mapped(page)); - ret = do_launder_page(mapping, page); - if (ret == 0 && !invalidate_complete_page2(mapping, page)) - ret = -EIO; + ret2 = do_launder_page(mapping, page); + if (ret2 == 0 && !invalidate_complete_page2(mapping, page)) + ret2 = -EIO; + if (ret2 < 0) + ret = ret2; unlock_page(page); } pagevec_release(&pvec); _ Patches currently in -mm which might be from hifumi.hisashi@xxxxxxxxxxxxx are fix-invalidate_inode_pages2_range-to-not-clear-ret.patch ext3-fdatasync-should-skip-metadata-writeout-when-overwriting.patch ext4-fdatasync-should-skip-metadata-writeout-when-overwriting.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html