Re: [PATCH] mm: fix page_mkclean_one (was: 2.6.19 file contentcorruption on ext3)

From: Trond Myklebust
Date: Wed Dec 20 2006 - 21:55:30 EST


On Wed, 2006-12-20 at 15:55 -0800, Linus Torvalds wrote:
> > With your change I think what'll happen is that we'll correctly handle the
> > case where the page and its buffers are dirty (it gets left in place), but
> > we'll needlessy fail in the case where the page is dirty but the buffers
> > are clean. How important that will be in practice I do not know. People
> > will get -EIOs where they used not to.
>
> People will now get -EIO where they used to get an inconsistent system
> image. I really think it sounds like an improvement.

The hell it is. You end up with a corrupted page cache because
invalidate_inode_pages2_range() immediately exits without throwing out
the pages in the rest of the range.

I can't see that it is the business of invalidate_inode_pages2() to
resolve races between ->direct_IO() and pages that are redirtied by
mmap(). All it needs to ensure is that pages that clean are discarded,
since those are neither consistent with data that the ->directIO() call
wrote to the disk nor are they scheduled to be written to disk.

The only case that I can see that is still problematic is NFS because it
may have unstable writes (hence the ->launder_page() patch that I posted
yesterday).

Trond

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/