From 3db7e2a8678c26c8faccc101dd3b35af164fb232 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Sun, 9 Nov 2003 15:18:35 -0800 Subject: [PATCH] [PATCH] JBD: fix assertion failure 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 possible that we free journal_heads which still have attached copyout buffers. So just free them up. --- fs/jbd/journal.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 9f88325e2a408..7550f31d02492 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c @@ -1729,8 +1729,18 @@ static void __journal_remove_journal_head(struct buffer_head *bh) 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); -- 2.53.0