From: "Duane Griffin" <duaneg@dghda.com>
To: akpm@linux-foundation.org
Cc: sct@redhat.com, adilger@clusterfs.com, Mingming <cmm@us.ibm.com>,
Sami Liedes <sliedes@cc.hut.fi>,
linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org,
Duane Griffin <duaneg@dghda.com>
Subject: [PATCH] ext4: handle deleting corrupted indirect blocks
Date: Tue, 8 Jul 2008 15:42:00 +0100 [thread overview]
Message-ID: <1215528121-26934-2-git-send-email-duaneg@dghda.com> (raw)
In-Reply-To: <1215528121-26934-1-git-send-email-duaneg@dghda.com>
While freeing indirect blocks we attach a journal head to the parent buffer
head, free the blocks, then journal the parent. If the indirect block list
is corrupted and points to the parent the journal head will be detached
when the block is cleared, causing an OOPS.
Check for that explicitly and handle it gracefully.
This patch fixes the third case (image hdb.20000057.nullderef.gz)
reported in http://bugzilla.kernel.org/show_bug.cgi?id=10882.
Signed-off-by: Duane Griffin <duaneg@dghda.com>
--
This is the ext4 version of an ext3 patch queued in -mm.
---
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 8d97077..f3cd914 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2179,7 +2179,20 @@ static void ext4_free_data(handle_t *handle, struct inode *inode,
if (this_bh) {
BUFFER_TRACE(this_bh, "call ext4_journal_dirty_metadata");
- ext4_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))
+ ext4_journal_dirty_metadata(handle, this_bh);
+ else
+ ext4_error(inode->i_sb, __func__,
+ "circular indirect block detected, "
+ "inode=%lu, block=%lu",
+ inode->i_ino, this_bh->b_blocknr);
}
}
next prev parent reply other threads:[~2008-07-08 14:42 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-08 14:41 [PATCH] ext4: handle corrupted orphan list at mount Duane Griffin
2008-07-08 14:42 ` Duane Griffin [this message]
2008-07-08 14:42 ` [PATCH] ext4: validate directory entry data before use Duane Griffin
2008-07-09 2:53 ` [PATCH] ext4: handle deleting corrupted indirect blocks Theodore Tso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1215528121-26934-2-git-send-email-duaneg@dghda.com \
--to=duaneg@dghda.com \
--cc=adilger@clusterfs.com \
--cc=akpm@linux-foundation.org \
--cc=cmm@us.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sct@redhat.com \
--cc=sliedes@cc.hut.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®