Hmm, spotted another bug in here too, which also affects mainline AFAIKS.

If the page is already uptodate, then a new buffer will get marked uptodate
but will remain "new"... thus if the read portion of the RMW operation fails,
then the error handler will zero this guy out "to prevent stale data
exposure".

Of course, the data is not stale because it is uptodate, so zeroing out will
cause data loss.

I fixed it thusly, because I think buffer_new should always be cleared
before marking a buffer uptodate. I don't know whether I'll bother submitting
this seperately from the new-aops lineup, but if anyone would like to,
feel free to add my SOB.

--
Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c
+++ linux-2.6/fs/buffer.c
@@ -1813,7 +1813,9 @@ static int __block_prepare_write(struct 
                                unmap_underlying_metadata(bh->b_bdev,
                                                        bh->b_blocknr);
                                if (PageUptodate(page)) {
+                                       clear_buffer_new(bh);
                                        set_buffer_uptodate(bh);
+                                       mark_buffer_dirty(bh);
                                        continue;
                                }
                                if (block_end > to || block_start < from) {

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to