linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Fix error handling on inode bitmap corruption
@ 2011-12-08 20:28 Jan Kara
  2011-12-08 20:28 ` [PATCH] ext3: " Jan Kara
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Jan Kara @ 2011-12-08 20:28 UTC (permalink / raw)
  To: linux-ext4; +Cc: Ted Tso, Jan Kara

When insert_inode_locked() fails in ext4_new_inode() it most likely means inode
bitmap got corrupted and we allocated again inode which is already in use. Also
doing unlock_new_inode() during error recovery is wrong since the inode does
not have I_NEW set. Fix the problem by jumping to fail: (instead of fail_drop:)
which declares filesystem error and does not call unlock_new_inode().

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext4/ialloc.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 00beb4f..8fb6844 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -885,8 +885,12 @@ got:
 	if (IS_DIRSYNC(inode))
 		ext4_handle_sync(handle);
 	if (insert_inode_locked(inode) < 0) {
-		err = -EINVAL;
-		goto fail_drop;
+		/*
+		 * Likely a bitmap corruption causing inode to be allocated
+		 * twice.
+		 */
+		err = -EIO;
+		goto fail;
 	}
 	spin_lock(&sbi->s_next_gen_lock);
 	inode->i_generation = sbi->s_next_generation++;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-12-18 21:28 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-08 20:28 [PATCH] ext4: Fix error handling on inode bitmap corruption Jan Kara
2011-12-08 20:28 ` [PATCH] ext3: " Jan Kara
2011-12-08 20:46   ` Eric Sandeen
2011-12-08 22:28     ` Jan Kara
2011-12-08 22:40       ` Eric Sandeen
2011-12-08 23:13     ` Jan Kara
2011-12-08 23:14       ` Eric Sandeen
2011-12-08 20:44 ` [PATCH] ext4: " Eric Sandeen
2011-12-08 22:21   ` Jan Kara
2011-12-18 21:28 ` Ted Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).