1 ext4: remove quota allocation when ext4_mb_new_blocks fails
3 From: Shen Feng <shen@cn.fujitsu.com>
5 Quota allocation is not removed when ext4_mb_new_blocks calls
6 kmem_cache_alloc failed. Also make sure the allocation context is freed
9 Signed-off-by: Shen Feng <shen@cn.fujitsu.com>
10 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
11 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 fs/ext4/mballoc.c | 10 ++++++----
14 1 file changed, 6 insertions(+), 4 deletions(-)
16 Index: linux-2.6.26-rc6/fs/ext4/mballoc.c
17 ===================================================================
18 --- linux-2.6.26-rc6.orig/fs/ext4/mballoc.c 2008-06-17 10:43:27.000000000 -0700
19 +++ linux-2.6.26-rc6/fs/ext4/mballoc.c 2008-06-17 10:43:28.000000000 -0700
20 @@ -4052,8 +4052,9 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t
22 ac = kmem_cache_alloc(ext4_ac_cachep, GFP_NOFS);
30 ext4_mb_poll_new_transaction(sb, handle);
31 @@ -4061,7 +4062,7 @@ ext4_fsblk_t ext4_mb_new_blocks(handle_t
32 *errp = ext4_mb_initialize_context(ac, ar);
39 ac->ac_op = EXT4_MB_HISTORY_PREALLOC;
40 @@ -4109,11 +4110,12 @@ repeat:
42 ext4_mb_release_context(ac);
46 + kmem_cache_free(ext4_ac_cachep, ac);
48 if (ar->len < inquota)
49 DQUOT_FREE_BLOCK(ar->inode, inquota - ar->len);
51 - kmem_cache_free(ext4_ac_cachep, ac);
54 static void ext4_mb_poll_new_transaction(struct super_block *sb,