Re: prepare_to_wait/waitqueue_active issues in 2.6

From: Anton Blanchard
Date: Sat Dec 13 2003 - 22:56:56 EST



> End result is waitqueue_active returns 0 and buffer_locked returns 1.
> We miss a wakeup. Game over. Ive attached a patch that forces the check
> to happen after we are put on the waitqueue. Thanks to Brian Twichell
> for the analysis and suggested fix for this.

This time for sure.

Anton

===== mm/filemap.c 1.212 vs edited =====
--- 1.212/mm/filemap.c Sun Oct 26 16:41:06 2003
+++ edited/mm/filemap.c Sun Dec 14 14:25:45 2003
@@ -299,6 +299,7 @@

do {
prepare_to_wait(waitqueue, &wait, TASK_UNINTERRUPTIBLE);
+ smp_mb();
if (test_bit(bit_nr, &page->flags)) {
sync_page(page);
io_schedule();
@@ -372,6 +373,7 @@

while (TestSetPageLocked(page)) {
prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
+ smp_mb();
if (PageLocked(page)) {
sync_page(page);
io_schedule();
===== fs/buffer.c 1.215 vs edited =====
--- 1.215/fs/buffer.c Tue Sep 30 11:12:02 2003
+++ edited/fs/buffer.c Sun Dec 14 14:24:26 2003
@@ -131,6 +131,7 @@

do {
prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE);
+ smp_mb();
if (buffer_locked(bh)) {
blk_run_queues();
io_schedule();
-
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/