[PATCH] Fix concurrent writepage and readpage
authorAndrew Morton <akpm@zip.com.au>
Sun, 5 May 2002 08:10:37 +0000 (01:10 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 5 May 2002 08:10:37 +0000 (01:10 -0700)
commitd58e41eec6859e9590f8f70ccdc1d58f4f6a1b84
tree7370e414989b6fc754e30985887a39af169f267e
parent4bcb66890a9ce4f68529e93b04e076a355798395
[PATCH] Fix concurrent writepage and readpage

Pages under writeback are not locked.  So it is possible (and quite
legal) for a page to be under readpage() while it is still under
writeback.  For a partially uptodate page with blocksize <
PAGE_CACHE_SIZE.

When this happens, the read and write I/O completion handlers get
confused over the shared BH_Async usage and the page ends up not
getting PG_writeback cleared.  Truncate gets stuck in D state.

The patch separates the read and write I/O completion state.

It also shuffles the buffer fields around.  Putting the
commonly-accessed b_state at offset zero shrinks the kernel by a few
hundred bytes because it can be accessed with indirect addressing, not
indirect+indexed.
drivers/block/ll_rw_blk.c
fs/buffer.c
fs/jbd/commit.c
fs/jbd/transaction.c
fs/reiserfs/inode.c
include/linux/buffer_head.h