From c575f5be7aa80f4dca75d646b9fffaf647f300b2 Mon Sep 17 00:00:00 2001 From: Duane Griffin Date: Fri, 25 Jul 2008 01:46:26 -0700 Subject: [PATCH] --- yaml --- r: 105850 b: refs/heads/master c: 3ccc3167b0e5d46ab3bf03e22fbdb7616ce038cd h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ext3/inode.c | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 042ea7aca574..9b1e70ef90d6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 95450f5a7e53d5752ce1a0d0b8282e10fe745ae0 +refs/heads/master: 3ccc3167b0e5d46ab3bf03e22fbdb7616ce038cd diff --git a/trunk/fs/ext3/inode.c b/trunk/fs/ext3/inode.c index 36f74f17a11c..3bf07d70b914 100644 --- a/trunk/fs/ext3/inode.c +++ b/trunk/fs/ext3/inode.c @@ -2127,7 +2127,21 @@ static void ext3_free_data(handle_t *handle, struct inode *inode, if (this_bh) { BUFFER_TRACE(this_bh, "call ext3_journal_dirty_metadata"); - ext3_journal_dirty_metadata(handle, this_bh); + + /* + * The buffer head should have an attached journal head at this + * point. However, if the data is corrupted and an indirect + * block pointed to itself, it would have been detached when + * the block was cleared. Check for this instead of OOPSing. + */ + if (bh2jh(this_bh)) + ext3_journal_dirty_metadata(handle, this_bh); + else + ext3_error(inode->i_sb, "ext3_free_data", + "circular indirect block detected, " + "inode=%lu, block=%llu", + inode->i_ino, + (unsigned long long)this_bh->b_blocknr); } }