aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorSalman Qazi <sqazi@google.com>2012-05-31 23:52:14 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-05-31 23:52:14 -0400
commit95599968d19db175829fb580baa6b68939b320fb (patch)
treef28bdf3d19f818a8d61dc68454c72d62e8247b05 /fs/ext4
parent02b7831019ea4e7994968c84b5826fa8b248ffc8 (diff)
ext4: remove mb_groups before tearing down the buddy_cache
We can't have references held on pages in the s_buddy_cache while we are trying to truncate its pages and put the inode. All the pages must be gone before we reach clear_inode. This can only be gauranteed if we can prevent new users from grabbing references to s_buddy_cache's pages. The original bug can be reproduced and the bug fix can be verified by: while true; do mount -t ext4 /dev/ram0 /export/hda3/ram0; \ umount /export/hda3/ram0; done & while true; do cat /proc/fs/ext4/ram0/mb_groups; done Signed-off-by: Salman Qazi <sqazi@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Cc: stable@kernel.org
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/mballoc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 3d9277c48bc8..1cd6994fc446 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2517,6 +2517,9 @@ int ext4_mb_release(struct super_block *sb)
2517 struct ext4_sb_info *sbi = EXT4_SB(sb); 2517 struct ext4_sb_info *sbi = EXT4_SB(sb);
2518 struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits); 2518 struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
2519 2519
2520 if (sbi->s_proc)
2521 remove_proc_entry("mb_groups", sbi->s_proc);
2522
2520 if (sbi->s_group_info) { 2523 if (sbi->s_group_info) {
2521 for (i = 0; i < ngroups; i++) { 2524 for (i = 0; i < ngroups; i++) {
2522 grinfo = ext4_get_group_info(sb, i); 2525 grinfo = ext4_get_group_info(sb, i);
@@ -2564,8 +2567,6 @@ int ext4_mb_release(struct super_block *sb)
2564 } 2567 }
2565 2568
2566 free_percpu(sbi->s_locality_groups); 2569 free_percpu(sbi->s_locality_groups);
2567 if (sbi->s_proc)
2568 remove_proc_entry("mb_groups", sbi->s_proc);
2569 2570
2570 return 0; 2571 return 0;
2571} 2572}