Messages in this thread Patch in this message | | | Date | Wed, 23 Jun 1999 18:44:09 +0200 (CEST) | From | Andrea Arcangeli <> | Subject | ll_rw_block mark_buffer_clean without the big kernel lock |
| |
ll_rw_block will refile the buffer, and currently it can do that without the big kernel lock held (at least in write-partial). I think we can't put the lock_kernel just around mark_buffer_clean (in a async_mark_buffer_clean style) because we would end waiting for the big kernel lock but with the io_request_lock just acquired while other part of the kernel gets the io_request_lock with the lock_kernel acquired.
I am not sure if we can make the buffer clean outside the io_request_lock (looks not to be sure that the req->bh won't change under us). Anyway the below patch will fix the race. It also fixes a wrong param to async_mark_buffer_dirty.
Index: linux/fs/buffer.c =================================================================== RCS file: /var/cvs/linux/fs/buffer.c,v retrieving revision 1.1.1.23 diff -u -r1.1.1.23 buffer.c --- linux/fs/buffer.c 1999/06/22 22:33:23 1.1.1.23 +++ linux/fs/buffer.c 1999/06/23 16:35:44 @@ -1539,7 +1539,7 @@ * lots of dirty pages. */ if (!test_and_set_bit(BH_Dirty, &bh->b_state)) { - __atomic_mark_buffer_dirty(bh, bdf_prm.b_un.age_buffer); + __atomic_mark_buffer_dirty(bh, 0); if (too_many_dirty_buffers) balance_dirty(bh->b_dev); } Index: linux/drivers/block/ll_rw_blk.c =================================================================== RCS file: /var/cvs/linux/drivers/block/ll_rw_blk.c,v retrieving revision 1.1.1.9 diff -u -r1.1.1.9 ll_rw_blk.c --- linux/drivers/block/ll_rw_blk.c 1999/06/14 17:12:07 1.1.1.9 +++ linux/drivers/block/ll_rw_blk.c 1999/06/23 16:36:26 @@ -634,13 +634,15 @@ for (i = 0; i < nr; i++) { if (bh[i]) { set_bit(BH_Req, &bh[i]->b_state); + lock_kernel(); #ifdef CONFIG_BLK_DEV_MD if (MAJOR(bh[i]->b_dev) == MD_MAJOR) { md_make_request(MINOR (bh[i]->b_dev), rw, bh[i]); - continue; - } + } else #endif - make_request(MAJOR(bh[i]->b_rdev), rw, bh[i]); + make_request(MAJOR(bh[i]->b_rdev), rw, bh[i]); + unlock_kernel(); + } } return; Andrea Arcangeli
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |