

Signed-off-by: Andrew Morton <akpm@osdl.org>
Index: linux-2.6.8-rc1/fs/jbd/checkpoint.c
===================================================================
--- linux-2.6.8-rc1.orig/fs/jbd/checkpoint.c	2004-03-11 21:28:50.000000000 +1100
+++ linux-2.6.8-rc1/fs/jbd/checkpoint.c	2004-07-15 10:03:27.623032107 +1000
@@ -132,6 +132,7 @@
 {
 	struct journal_head *jh, *next_jh, *last_jh;
 	struct buffer_head *bh;
+	unsigned char nr_buffers = 1;
 	int ret = 0;
 
 	assert_spin_locked(&journal->j_list_lock);
@@ -185,9 +186,15 @@
 			journal_remove_journal_head(bh);
 			__brelse(bh);
 			ret = 1;
+			nr_buffers++;
 		} else {
 			jbd_unlock_bh_state(bh);
 		}
+		if (nr_buffers == 0) {
+			spin_lock(&journal->j_list_lock);
+			cpu_relax();
+			goto out_return_1;
+		}
 		jh = next_jh;
 	} while (jh != last_jh);
 
