diff options
author | Tao Ma <boyu.mt@taobao.com> | 2011-10-06 12:10:11 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-10-06 12:10:11 -0400 |
commit | dcf2d804ed6ffe5e942b909ed5e5b74628be6ee4 (patch) | |
tree | a15433ea17d943116c809c1a847e45a387120f19 /fs/ext4/super.c | |
parent | 7aa0baeaba4afc4fbed7aad2812a1116e6b0adcd (diff) |
ext4: Free resources in some error path in ext4_fill_super
Some of the error path in ext4_fill_super don't release the
resouces properly. So this patch just try to release them
in the right way.
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 07f3de341452..db2cd3f21074 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3785,22 +3785,19 @@ no_journal: | |||
3785 | if (err) { | 3785 | if (err) { |
3786 | ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", | 3786 | ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)", |
3787 | err); | 3787 | err); |
3788 | goto failed_mount4; | 3788 | goto failed_mount5; |
3789 | } | 3789 | } |
3790 | 3790 | ||
3791 | err = ext4_register_li_request(sb, first_not_zeroed); | 3791 | err = ext4_register_li_request(sb, first_not_zeroed); |
3792 | if (err) | 3792 | if (err) |
3793 | goto failed_mount4; | 3793 | goto failed_mount6; |
3794 | 3794 | ||
3795 | sbi->s_kobj.kset = ext4_kset; | 3795 | sbi->s_kobj.kset = ext4_kset; |
3796 | init_completion(&sbi->s_kobj_unregister); | 3796 | init_completion(&sbi->s_kobj_unregister); |
3797 | err = kobject_init_and_add(&sbi->s_kobj, &ext4_ktype, NULL, | 3797 | err = kobject_init_and_add(&sbi->s_kobj, &ext4_ktype, NULL, |
3798 | "%s", sb->s_id); | 3798 | "%s", sb->s_id); |
3799 | if (err) { | 3799 | if (err) |
3800 | ext4_mb_release(sb); | 3800 | goto failed_mount7; |
3801 | ext4_ext_release(sb); | ||
3802 | goto failed_mount4; | ||
3803 | }; | ||
3804 | 3801 | ||
3805 | EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS; | 3802 | EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS; |
3806 | ext4_orphan_cleanup(sb, es); | 3803 | ext4_orphan_cleanup(sb, es); |
@@ -3834,13 +3831,19 @@ cantfind_ext4: | |||
3834 | ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); | 3831 | ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); |
3835 | goto failed_mount; | 3832 | goto failed_mount; |
3836 | 3833 | ||
3834 | failed_mount7: | ||
3835 | ext4_unregister_li_request(sb); | ||
3836 | failed_mount6: | ||
3837 | ext4_ext_release(sb); | ||
3838 | failed_mount5: | ||
3839 | ext4_mb_release(sb); | ||
3840 | ext4_release_system_zone(sb); | ||
3837 | failed_mount4: | 3841 | failed_mount4: |
3838 | iput(root); | 3842 | iput(root); |
3839 | sb->s_root = NULL; | 3843 | sb->s_root = NULL; |
3840 | ext4_msg(sb, KERN_ERR, "mount failed"); | 3844 | ext4_msg(sb, KERN_ERR, "mount failed"); |
3841 | destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq); | 3845 | destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq); |
3842 | failed_mount_wq: | 3846 | failed_mount_wq: |
3843 | ext4_release_system_zone(sb); | ||
3844 | if (sbi->s_journal) { | 3847 | if (sbi->s_journal) { |
3845 | jbd2_journal_destroy(sbi->s_journal); | 3848 | jbd2_journal_destroy(sbi->s_journal); |
3846 | sbi->s_journal = NULL; | 3849 | sbi->s_journal = NULL; |