aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2014-11-25 13:08:04 -0500
committerTheodore Ts'o <tytso@mit.edu>2014-11-25 13:08:04 -0500
commit4fdb5543183d027a19805b72025b859af73d0863 (patch)
tree708afd14a45f9f38f37dfb8c4bfb2b1ef045a37b
parent2be12de98a1cc21c4de4e2d6fb2bf5aa0a279947 (diff)
ext4: cleanup GFP flags inside resize path
We must use GFP_NOFS instead GFP_KERNEL inside ext4_mb_add_groupinfo and ext4_calculate_overhead() because they are called from inside a journal transaction. Call trace: ioctl ->ext4_group_add ->journal_start ->ext4_setup_new_descs ->ext4_mb_add_groupinfo -> GFP_KERNEL ->ext4_flex_group_add ->ext4_update_super ->ext4_calculate_overhead -> GFP_KERNEL ->journal_stop Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/mballoc.c6
-rw-r--r--fs/ext4/super.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 004d0ff8325f..f1c25f83fc7d 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2385,7 +2385,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
2385 if (group % EXT4_DESC_PER_BLOCK(sb) == 0) { 2385 if (group % EXT4_DESC_PER_BLOCK(sb) == 0) {
2386 metalen = sizeof(*meta_group_info) << 2386 metalen = sizeof(*meta_group_info) <<
2387 EXT4_DESC_PER_BLOCK_BITS(sb); 2387 EXT4_DESC_PER_BLOCK_BITS(sb);
2388 meta_group_info = kmalloc(metalen, GFP_KERNEL); 2388 meta_group_info = kmalloc(metalen, GFP_NOFS);
2389 if (meta_group_info == NULL) { 2389 if (meta_group_info == NULL) {
2390 ext4_msg(sb, KERN_ERR, "can't allocate mem " 2390 ext4_msg(sb, KERN_ERR, "can't allocate mem "
2391 "for a buddy group"); 2391 "for a buddy group");
@@ -2399,7 +2399,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
2399 sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)]; 2399 sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)];
2400 i = group & (EXT4_DESC_PER_BLOCK(sb) - 1); 2400 i = group & (EXT4_DESC_PER_BLOCK(sb) - 1);
2401 2401
2402 meta_group_info[i] = kmem_cache_zalloc(cachep, GFP_KERNEL); 2402 meta_group_info[i] = kmem_cache_zalloc(cachep, GFP_NOFS);
2403 if (meta_group_info[i] == NULL) { 2403 if (meta_group_info[i] == NULL) {
2404 ext4_msg(sb, KERN_ERR, "can't allocate buddy mem"); 2404 ext4_msg(sb, KERN_ERR, "can't allocate buddy mem");
2405 goto exit_group_info; 2405 goto exit_group_info;
@@ -2428,7 +2428,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
2428 { 2428 {
2429 struct buffer_head *bh; 2429 struct buffer_head *bh;
2430 meta_group_info[i]->bb_bitmap = 2430 meta_group_info[i]->bb_bitmap =
2431 kmalloc(sb->s_blocksize, GFP_KERNEL); 2431 kmalloc(sb->s_blocksize, GFP_NOFS);
2432 BUG_ON(meta_group_info[i]->bb_bitmap == NULL); 2432 BUG_ON(meta_group_info[i]->bb_bitmap == NULL);
2433 bh = ext4_read_block_bitmap(sb, group); 2433 bh = ext4_read_block_bitmap(sb, group);
2434 BUG_ON(bh == NULL); 2434 BUG_ON(bh == NULL);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 48318497e8e9..b643009fddfe 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3300,7 +3300,7 @@ int ext4_calculate_overhead(struct super_block *sb)
3300 struct ext4_super_block *es = sbi->s_es; 3300 struct ext4_super_block *es = sbi->s_es;
3301 ext4_group_t i, ngroups = ext4_get_groups_count(sb); 3301 ext4_group_t i, ngroups = ext4_get_groups_count(sb);
3302 ext4_fsblk_t overhead = 0; 3302 ext4_fsblk_t overhead = 0;
3303 char *buf = (char *) get_zeroed_page(GFP_KERNEL); 3303 char *buf = (char *) get_zeroed_page(GFP_NOFS);
3304 3304
3305 if (!buf) 3305 if (!buf)
3306 return -ENOMEM; 3306 return -ENOMEM;