diff -urN 2.4.10/fs/buffer.c highmem/fs/buffer.c --- 2.4.10/fs/buffer.c Sun Sep 23 21:11:39 2001 +++ highmem/fs/buffer.c Fri Sep 28 01:48:22 2001 @@ -190,6 +190,7 @@ do { struct buffer_head * bh = *array++; bh->b_end_io = end_buffer_io_sync; + clear_bit(BH_Pending_IO, &bh->b_state); submit_bh(WRITE, bh); } while (--count); } @@ -222,6 +223,7 @@ if (atomic_set_buffer_clean(bh)) { __refile_buffer(bh); get_bh(bh); + set_bit(BH_Pending_IO, &bh->b_state); array[count++] = bh; if (count < NRSYNC) continue; @@ -2516,7 +2518,9 @@ int tryagain = 1; do { - if (buffer_dirty(p) || buffer_locked(p)) { + if (unlikely(buffer_pending_IO(p))) + tryagain = 0; + else if (buffer_dirty(p) || buffer_locked(p)) { if (test_and_set_bit(BH_Wait_IO, &p->b_state)) { if (buffer_dirty(p)) { ll_rw_block(WRITE, 1, &p); diff -urN 2.4.10/include/linux/fs.h highmem/include/linux/fs.h --- 2.4.10/include/linux/fs.h Sun Sep 23 21:11:42 2001 +++ highmem/include/linux/fs.h Fri Sep 28 01:47:51 2001 @@ -217,6 +217,7 @@ BH_New, /* 1 if the buffer is new and not yet written out */ BH_Async, /* 1 if the buffer is under end_buffer_io_async I/O */ BH_Wait_IO, /* 1 if we should throttle on this buffer */ + BH_Pending_IO, /* 1 if the buffer is locked but not in the I/O queue yet */ BH_PrivateStart,/* not a state bit, but the first bit available * for private allocation by other entities @@ -277,6 +278,7 @@ #define buffer_mapped(bh) __buffer_state(bh,Mapped) #define buffer_new(bh) __buffer_state(bh,New) #define buffer_async(bh) __buffer_state(bh,Async) +#define buffer_pending_IO(bh) __buffer_state(bh,Pending_IO) #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)