--On 09/17/00 20:30:29 -0700 Linus Torvalds <[EMAIL PROTECTED]> wrote:
>
> Basically, both "truncate()" and "write()" have this bug where they can
> end up re-reading stuff from disk even though the in-memory copy is newer.
>
> And because write() had this bug, the bug also got into
> block_write_full_page(). Not because block_write_full_page() was buggy in
> itself, but because it used a buggy routine.
>
> And your patch fixes the corruption, not by fixing the bug, but by
> avoiding the buggy routing in block_write_full_page().
>
> We need to fix the real bug - otherwise anybody doing both write() and
> shared mmap's to the same file is going to be bit by it later on...
>
> The easy fix is probably to do something like
>
> /* Map the buffer */
> if (!buffer_mapped(bh)) {
> ...
> }
> + /* If the page is up-to-date, so is the buffer */
> + if (Page_Uptodate(page))
> + set_bit(BH_Uptodate, &bh->b_state);
>
> /* Ok, now it was _truly_ not uptodate */
> if (!buffer_uptodate(bh))
> ll_rw_block(READ, 1, &bh);
>
> Comments? The above should fix block_write_full_page() automatically, as
> well as fixing the other cases too - and actually improve performance at
> the same time by getting rid of unnecessary re-reads.
>
ReiserFS depends on the buffer head up to date flag being correct when it
is sent to get_block. When unpacking the tail, we have to know if the
packed data on disk should be copied over the data in the page.
So, the above should work for us if you tested Page_Uptodate before testing
buffer_mapped.
-chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/