

This fixes a JBD assertion failure (goes BUG) in __journal_remove_journal_head().

When the journal had aborted due to earlier internal consistency errors (or
I/O errors) it is posible that we free journal_heads which still have
attached copyout buffers.  So just free them up.



 fs/jbd/journal.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff -puN fs/jbd/journal.c~journal_remove_journal_head-assertion-fix fs/jbd/journal.c
--- 25/fs/jbd/journal.c~journal_remove_journal_head-assertion-fix	2003-11-01 14:33:27.000000000 -0800
+++ 25-akpm/fs/jbd/journal.c	2003-11-01 14:38:00.000000000 -0800
@@ -1729,8 +1729,18 @@ static void __journal_remove_journal_hea
 			J_ASSERT_BH(bh, buffer_jbd(bh));
 			J_ASSERT_BH(bh, jh2bh(jh) == bh);
 			BUFFER_TRACE(bh, "remove journal_head");
-			J_ASSERT_BH(bh, !jh->b_frozen_data);
-			J_ASSERT_BH(bh, !jh->b_committed_data);
+			if (jh->b_frozen_data) {
+				printk(KERN_WARNING "%s: freeing "
+						"b_frozen_data\n",
+						__FUNCTION__);
+				kfree(jh->b_frozen_data);
+			}
+			if (jh->b_committed_data) {
+				printk(KERN_WARNING "%s: freeing "
+						"b_committed_data\n",
+						__FUNCTION__);
+				kfree(jh->b_committed_data);
+			}
 			bh->b_private = NULL;
 			jh->b_bh = NULL;	/* debug, really */
 			clear_buffer_jbd(bh);

_
