The following patch seems to get rid of a race condition (you need several
more to clear out all similar race conditions in the kernel):
diff /work/linux/linuxref/fs/buffer.c -> buffer.c
--- /work/linux/linuxref/fs/buffer.c Fri Dec 12 03:54:40 1997
+++ /work/linux/linux/fs/buffer.c Mon Dec 22 01:38:24 1997
@@ -115,12 +115,13 @@
struct wait_queue wait = { current, NULL };
bh->b_count++;
+ current->state = TASK_UNINTERRUPTIBLE;
add_wait_queue(&bh->b_wait, &wait);
repeat:
run_task_queue(&tq_disk);
- current->state = TASK_UNINTERRUPTIBLE;
if (buffer_locked(bh)) {
schedule();
+ current->state = TASK_UNINTERRUPTIBLE;
goto repeat;
}
remove_wait_queue(&bh->b_wait, &wait);
I didn't check the sources for 2.1.x yet, but quite possibly it contains
similarly flawed constructs.
-- Sincerely, srb@cuci.nl Stephen R. van den Berg (AKA BuGless)."Father's Day: Nine months before Mother's Day."