diff options
| author | Jan Kara <jack@suse.cz> | 2011-12-08 15:13:46 -0500 |
|---|---|---|
| committer | Luis Henriques <luis.henriques@canonical.com> | 2012-05-25 12:24:50 -0400 |
| commit | 28ce43ff2498c0677702849ddf53edc0ae9a98a2 (patch) | |
| tree | 678a6c979eda2181833033010d543ca81e52352f /fs | |
| parent | 2bd5653b51527b98f7502f7f13adf3662bfde110 (diff) | |
ext3: Fix error handling on inode bitmap corruption
BugLink: http://bugs.launchpad.net/bugs/1002880
commit 1415dd8705394399d59a3df1ab48d149e1e41e77 upstream.
When insert_inode_locked() fails in ext3_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 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().
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ext3/ialloc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index bfc2dc43681..0b3da7cc8ab 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
| @@ -561,8 +561,12 @@ got: | |||
| 561 | if (IS_DIRSYNC(inode)) | 561 | if (IS_DIRSYNC(inode)) |
| 562 | handle->h_sync = 1; | 562 | handle->h_sync = 1; |
| 563 | if (insert_inode_locked(inode) < 0) { | 563 | if (insert_inode_locked(inode) < 0) { |
| 564 | err = -EINVAL; | 564 | /* |
| 565 | goto fail_drop; | 565 | * Likely a bitmap corruption causing inode to be allocated |
| 566 | * twice. | ||
| 567 | */ | ||
| 568 | err = -EIO; | ||
| 569 | goto fail; | ||
| 566 | } | 570 | } |
| 567 | spin_lock(&sbi->s_next_gen_lock); | 571 | spin_lock(&sbi->s_next_gen_lock); |
| 568 | inode->i_generation = sbi->s_next_generation++; | 572 | inode->i_generation = sbi->s_next_generation++; |
