Messages in this thread | | | Date | Wed, 1 Sep 1999 07:54:50 -0700 | From | "David S. Miller" <> | Subject | Re: [patch] flushpage SMP race with ll_rw_block/bdflush |
| |
Date: Wed, 1 Sep 1999 16:41:49 +0200 (CEST) From: Andrea Arcangeli <andrea@suse.de>
this patch against 2.3.16 should fix the SMP race:
--- 2.3.16-flushpage/fs/buffer.c.~1~ Wed Sep 1 09:30:03 1999 +++ 2.3.16-flushpage/fs/buffer.c Wed Sep 1 16:21:54 1999 @@ -1231,16 +1231,10 @@ */ if (offset <= curr_off) { if (buffer_mapped(bh)) { - atomic_inc(&bh->b_count); - wait_on_buffer(bh); if (bh->b_dev == B_FREE) BUG(); mark_buffer_clean(bh); - clear_bit(BH_Uptodate, &bh->b_state); - clear_bit(BH_Mapped, &bh->b_state); - clear_bit(BH_Req, &bh->b_state); - bh->b_blocknr = 0; - atomic_dec(&bh->b_count); + wait_on_buffer(bh); } } curr_off = next_off;
I removed also the atomic_dec/inc since they are useless.
Maybe a better idea is to sleep until we can obtain the buffer locked ourselves, this %100 guarentees that ll_rw_block will not do anything with the buffer.
On the otherhand, I cannot convince myself that your change is safe and %100 fixes the race and also does not create new ones.
Later, David S. Miller davem@redhat.com
- 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/
| |