1 ext4: cleanup GFP flags inside resize path
3 From: Dmitry Monakhov <dmonakhov@openvz.org>
5 We must use GFP_NOFS instead GFP_KERNEL inside ext4_mb_add_groupinfo
6 and ext4_calculate_overhead() because they are called from inside a
7 journal transaction. Call trace:
12 ->ext4_setup_new_descs
13 ->ext4_mb_add_groupinfo -> GFP_KERNEL
16 ->ext4_calculate_overhead -> GFP_KERNEL
19 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
20 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
22 fs/ext4/mballoc.c | 6 +++---
23 fs/ext4/super.c | 2 +-
24 2 files changed, 4 insertions(+), 4 deletions(-)
26 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
27 index dbfe15c..654e70d 100644
28 --- a/fs/ext4/mballoc.c
29 +++ b/fs/ext4/mballoc.c
30 @@ -2385,7 +2385,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
31 if (group % EXT4_DESC_PER_BLOCK(sb) == 0) {
32 metalen = sizeof(*meta_group_info) <<
33 EXT4_DESC_PER_BLOCK_BITS(sb);
34 - meta_group_info = kmalloc(metalen, GFP_KERNEL);
35 + meta_group_info = kmalloc(metalen, GFP_NOFS);
36 if (meta_group_info == NULL) {
37 ext4_msg(sb, KERN_ERR, "can't allocate mem "
39 @@ -2399,7 +2399,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
40 sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)];
41 i = group & (EXT4_DESC_PER_BLOCK(sb) - 1);
43 - meta_group_info[i] = kmem_cache_zalloc(cachep, GFP_KERNEL);
44 + meta_group_info[i] = kmem_cache_zalloc(cachep, GFP_NOFS);
45 if (meta_group_info[i] == NULL) {
46 ext4_msg(sb, KERN_ERR, "can't allocate buddy mem");
48 @@ -2428,7 +2428,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
50 struct buffer_head *bh;
51 meta_group_info[i]->bb_bitmap =
52 - kmalloc(sb->s_blocksize, GFP_KERNEL);
53 + kmalloc(sb->s_blocksize, GFP_NOFS);
54 BUG_ON(meta_group_info[i]->bb_bitmap == NULL);
55 bh = ext4_read_block_bitmap(sb, group);
57 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
58 index 2c9e686..5f6cab8 100644
61 @@ -3310,7 +3310,7 @@ int ext4_calculate_overhead(struct super_block *sb)
62 struct ext4_super_block *es = sbi->s_es;
63 ext4_group_t i, ngroups = ext4_get_groups_count(sb);
64 ext4_fsblk_t overhead = 0;
65 - char *buf = (char *) get_zeroed_page(GFP_KERNEL);
66 + char *buf = (char *) get_zeroed_page(GFP_NOFS);