Whamcloud - gitweb
LU-2370 ldiskfs: fix procfs access to mb groups.
authorAlexey Lyashkov <alexey_lyashkov@xyratex.com>
Mon, 19 Nov 2012 10:53:00 +0000 (14:53 +0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 30 Nov 2012 19:14:33 +0000 (14:14 -0500)
backporting a fix 95599968d19db175829fb580baa6b68939b320fb
from kernel.org
with additional memory allocation error handling.

Xyratex-bug-id: MRP-757
Change-Id: I33e7daa18c8b74e34bbd1e12120e27ab7be23cf5
Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Reviewed-on: http://review.whamcloud.com/4654
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
ldiskfs/kernel_patches/patches/ext4-fix-mbgroups-access.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series

diff --git a/ldiskfs/kernel_patches/patches/ext4-fix-mbgroups-access.patch b/ldiskfs/kernel_patches/patches/ext4-fix-mbgroups-access.patch
new file mode 100644 (file)
index 0000000..e6fc5e2
--- /dev/null
@@ -0,0 +1,34 @@
+Index: linux-stage/fs/ext4/mballoc.c
+===================================================================
+--- linux-stage.orig/fs/ext4/mballoc.c 2012-11-21 11:22:19.000000000 +0200
++++ linux-stage/fs/ext4/mballoc.c      2012-11-21 11:24:33.000000000 +0200
+@@ -2622,6 +2622,9 @@ int ext4_mb_release(struct super_block *
+       struct ext4_group_info *grinfo;
+       struct ext4_sb_info *sbi = EXT4_SB(sb);
++      if (sbi->s_proc)
++              remove_proc_entry("mb_groups", sbi->s_proc);
++
+       if (sbi->s_group_info) {
+               for (i = 0; i < ngroups; i++) {
+                       grinfo = ext4_get_group_info(sb, i);
+@@ -2673,7 +2676,6 @@ int ext4_mb_release(struct super_block *
+       free_percpu(sbi->s_locality_groups);
+       if (sbi->s_proc) {
+-              remove_proc_entry("mb_groups", sbi->s_proc);
+               remove_proc_entry(EXT4_MB_PREALLOC_TABLE, sbi->s_proc);
+       }
+@@ -4801,6 +4803,11 @@ do_more:
+                * be used until this transaction is committed
+                */
+               new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS);
++              if (!new_entry) {
++                      ext4_mb_release_desc(&e4b);
++                      err = -ENOMEM;
++                      goto error_return;
++              }
+               new_entry->efd_start_blk = bit;
+               new_entry->efd_group  = block_group;
+               new_entry->efd_count = count;
index 1d90c78..261528a 100644 (file)
@@ -38,3 +38,4 @@ ext4-quota-force-block-alloc-quotaoff.patch
 ext4-quota-dont-update-cmtime.patch
 ext4-quota-first-class.patch
 ext4-inode_info_reorganize.patch
+ext4-fix-mbgroups-access.patch