Whamcloud - gitweb
LU-2370 ldiskfs: fix procfs access to mb groups.
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-fix-mbgroups-access.patch
1 Index: linux-stage/fs/ext4/mballoc.c
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/mballoc.c  2012-11-21 11:22:19.000000000 +0200
4 +++ linux-stage/fs/ext4/mballoc.c       2012-11-21 11:24:33.000000000 +0200
5 @@ -2622,6 +2622,9 @@ int ext4_mb_release(struct super_block *
6         struct ext4_group_info *grinfo;
7         struct ext4_sb_info *sbi = EXT4_SB(sb);
8  
9 +       if (sbi->s_proc)
10 +               remove_proc_entry("mb_groups", sbi->s_proc);
11 +
12         if (sbi->s_group_info) {
13                 for (i = 0; i < ngroups; i++) {
14                         grinfo = ext4_get_group_info(sb, i);
15 @@ -2673,7 +2676,6 @@ int ext4_mb_release(struct super_block *
16  
17         free_percpu(sbi->s_locality_groups);
18         if (sbi->s_proc) {
19 -               remove_proc_entry("mb_groups", sbi->s_proc);
20                 remove_proc_entry(EXT4_MB_PREALLOC_TABLE, sbi->s_proc);
21         }
22  
23 @@ -4801,6 +4803,11 @@ do_more:
24                  * be used until this transaction is committed
25                  */
26                 new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
27 +               if (!new_entry) {
28 +                       ext4_mb_release_desc(&e4b);
29 +                       err = -ENOMEM;
30 +                       goto error_return;
31 +               }
32                 new_entry->efd_start_blk = bit;
33                 new_entry->efd_group  = block_group;
34                 new_entry->efd_count = count;