diff options
author | Salman Qazi <sqazi@google.com> | 2012-05-31 23:52:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-09 11:33:04 -0400 |
commit | 32e090b1f4bdfe9756e1b8f0b5280acb036d1c61 (patch) | |
tree | 08ae90466ca26a7e722623fad696f43feb5b2a6c /fs | |
parent | 97434cf53353728708c133af183a11a158c8c26a (diff) |
ext4: remove mb_groups before tearing down the buddy_cache
commit 95599968d19db175829fb580baa6b68939b320fb upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/mballoc.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index e3d55756997..b6adf68a5c0 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c | |||
@@ -2528,6 +2528,9 @@ int ext4_mb_release(struct super_block *sb) | |||
2528 | struct ext4_sb_info *sbi = EXT4_SB(sb); | 2528 | struct ext4_sb_info *sbi = EXT4_SB(sb); |
2529 | struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits); | 2529 | struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits); |
2530 | 2530 | ||
2531 | if (sbi->s_proc) | ||
2532 | remove_proc_entry("mb_groups", sbi->s_proc); | ||
2533 | |||
2531 | if (sbi->s_group_info) { | 2534 | if (sbi->s_group_info) { |
2532 | for (i = 0; i < ngroups; i++) { | 2535 | for (i = 0; i < ngroups; i++) { |
2533 | grinfo = ext4_get_group_info(sb, i); | 2536 | grinfo = ext4_get_group_info(sb, i); |
@@ -2575,8 +2578,6 @@ int ext4_mb_release(struct super_block *sb) | |||
2575 | } | 2578 | } |
2576 | 2579 | ||
2577 | free_percpu(sbi->s_locality_groups); | 2580 | free_percpu(sbi->s_locality_groups); |
2578 | if (sbi->s_proc) | ||
2579 | remove_proc_entry("mb_groups", sbi->s_proc); | ||
2580 | 2581 | ||
2581 | return 0; | 2582 | return 0; |
2582 | } | 2583 | } |