--- 2.4.18rc4aa1/fs/buffer.c.~1~ Sat Feb 23 08:21:00 2002 +++ 2.4.18rc4aa1/fs/buffer.c Sun Feb 24 04:48:03 2002 @@ -1721,6 +1721,13 @@ if (buffer_new(bh)) { unmap_underlying_metadata(bh); if (Page_Uptodate(page)) { + /* + * Avoid new and uptodate to be set at the same time + * so we can retain the buffer_uptodate() bugcheck in + * the undo/fixup pass below (goto out path). + */ + clear_bit(BH_New, &bh->b_state); + set_bit(BH_Uptodate, &bh->b_state); continue; } @@ -1757,8 +1764,16 @@ * Zero out any newly allocated blocks to avoid exposing stale * data. If BH_New is set, we know that the block was newly * allocated in the above loop. + * + * Details: + * 1) hole in uptodate page, get_block(create) allocate the block, so the buffer is + * new and additionally we also mark it uptodate (so remeber to clear BH_New + * above to avoid triggering the "zeroing" printk below). + * 2) we must stop the "undo/clear" fixup pass not at the caller "to" but at the last + * block that we successfully arrived in the main loop. */ bh = head; + to = block_start; /* stop at the last successfully handled block */ block_start = 0; do { block_end = block_start+blocksize;