--- VM-locked/fs/buffer.c.~1~ Sun Feb 18 04:01:32 2001 +++ VM-locked/fs/buffer.c Sun Feb 18 23:03:32 2001 @@ -1530,9 +1530,13 @@ struct buffer_head *p = tmp; tmp = tmp->b_this_page; - if (buffer_dirty(p)) - if (test_and_set_bit(BH_Wait_IO, &p->b_state)) - ll_rw_block(WRITE, 1, &p); + 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); + else if (buffer_locked(p)) + wait_on_buffer(p); + } } while (tmp != bh); /* Restore the visibility of the page before returning. */ --- VM-locked/include/linux/fs.h.~1~ Sun Feb 18 04:01:32 2001 +++ VM-locked/include/linux/fs.h Sun Feb 18 22:59:00 2001 @@ -810,7 +810,6 @@ if (test_and_clear_bit(BH_Dirty, &bh->b_state)) { if (bh->b_list == BUF_DIRTY) refile_buffer(bh); - clear_bit(BH_Wait_IO, &bh->b_state); } } --- VM-locked/include/linux/locks.h.~1~ Sun Feb 18 06:31:15 2001 +++ VM-locked/include/linux/locks.h Sun Feb 18 22:59:09 2001 @@ -29,6 +29,7 @@ extern inline void unlock_buffer(struct buffer_head *bh) { clear_bit(BH_Lock, &bh->b_state); + clear_bit(BH_Wait_IO, &bh->b_state); wake_up(&bh->b_wait); }