Whamcloud - gitweb
LU-3036 mdt: set ATTR_xTIME_SET to make atime update properly
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / sles11sp2 / ext4-free-resources-in-some-error-path-in-ext4_fill_super.patch
1 From dcf2d804ed6ffe5e942b909ed5e5b74628be6ee4 Mon Sep 17 00:00:00 2001
2 From: Tao Ma <boyu.mt@taobao.com>
3 Date: Thu, 6 Oct 2011 12:10:11 -0400
4 Subject: ext4: Free resources in some error path in ext4_fill_super
5 Git-commit: dcf2d804
6 Patch-mainline: v3.2-rc1
7
8 Some of the error path in ext4_fill_super don't release the
9 resouces properly. So this patch just try to release them
10 in the right way.
11
12 Upstream-Signed-off-by: Tao Ma <boyu.mt@taobao.com>
13 Upstream-Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
14 Signed-off-by: Jeff Mahoney <jeffm@suse.com>
15 ---
16  fs/ext4/super.c |   19 +++++++++++--------
17  1 file changed, 11 insertions(+), 8 deletions(-)
18
19 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
20 index 07f3de3..db2cd3f 100644
21 --- a/fs/ext4/super.c
22 +++ b/fs/ext4/super.c
23 @@ -3785,22 +3785,19 @@ no_journal:
24         if (err) {
25                 ext4_msg(sb, KERN_ERR, "failed to initialize mballoc (%d)",
26                          err);
27 -               goto failed_mount4;
28 +               goto failed_mount5;
29         }
30
31         err = ext4_register_li_request(sb, first_not_zeroed);
32         if (err)
33 -               goto failed_mount4;
34 +               goto failed_mount6;
35
36         sbi->s_kobj.kset = ext4_kset;
37         init_completion(&sbi->s_kobj_unregister);
38         err = kobject_init_and_add(&sbi->s_kobj, &ext4_ktype, NULL,
39                                    "%s", sb->s_id);
40 -       if (err) {
41 -               ext4_mb_release(sb);
42 -               ext4_ext_release(sb);
43 -               goto failed_mount4;
44 -       };
45 +       if (err)
46 +               goto failed_mount7;
47
48         EXT4_SB(sb)->s_mount_state |= EXT4_ORPHAN_FS;
49         ext4_orphan_cleanup(sb, es);
50 @@ -3834,13 +3831,19 @@ cantfind_ext4:
51                 ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
52         goto failed_mount;
53
54 +failed_mount7:
55 +       ext4_unregister_li_request(sb);
56 +failed_mount6:
57 +       ext4_ext_release(sb);
58 +failed_mount5:
59 +       ext4_mb_release(sb);
60 +       ext4_release_system_zone(sb);
61  failed_mount4:
62         iput(root);
63         sb->s_root = NULL;
64         ext4_msg(sb, KERN_ERR, "mount failed");
65         destroy_workqueue(EXT4_SB(sb)->dio_unwritten_wq);
66  failed_mount_wq:
67 -       ext4_release_system_zone(sb);
68         if (sbi->s_journal) {
69                 jbd2_journal_destroy(sbi->s_journal);
70                 sbi->s_journal = NULL;
71