Re: [PATCH] per-backing dev unplugging #2

From: Chris Mason
Date: Mon Mar 15 2004 - 17:00:06 EST


Hmpf, one more. If one proc does a wait_on_buffer while another does
discard_buffer, bh->b_bdev might be null by the time __wait_on_buffer
uses it.

Someone hit this with reiserfs, but it should be possible to trigger
anywhere.

-chris

Index: linux.t/fs/buffer.c
===================================================================
--- linux.t.orig/fs/buffer.c 2004-03-15 15:05:38.000000000 -0500
+++ linux.t/fs/buffer.c 2004-03-15 16:49:17.000000000 -0500
@@ -132,7 +132,11 @@ void __wait_on_buffer(struct buffer_head
do {
prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
if (buffer_locked(bh)) {
- blk_run_address_space(bh->b_bdev->bd_inode->i_mapping);
+ struct block_device *bd;
+ smp_mb();
+ bd = bh->b_bdev;
+ if (bd)
+ blk_run_address_space(bd->bd_inode->i_mapping);
io_schedule();
}
} while (buffer_locked(bh));







-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/