Fix grammar in comment.
[ext4-patch-queue.git] / ext4-cleanup-quota-when-ext4_mb_new_blocks-failure.patch
blobbb426d1a98d4facd5f650f5b5aca1524e287233b
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
7 on the error path.
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>
12 ---
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);
23 if (!ac) {
24 + ar->len = 0;
25 *errp = -ENOMEM;
26 - return 0;
27 + goto out1;
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);
33 if (*errp) {
34 ar->len = 0;
35 - goto out;
36 + goto out2;
39 ac->ac_op = EXT4_MB_HISTORY_PREALLOC;
40 @@ -4109,11 +4110,12 @@ repeat:
42 ext4_mb_release_context(ac);
44 -out:
45 +out2:
46 + kmem_cache_free(ext4_ac_cachep, ac);
47 +out1:
48 if (ar->len < inquota)
49 DQUOT_FREE_BLOCK(ar->inode, inquota - ar->len);
51 - kmem_cache_free(ext4_ac_cachep, ac);
52 return block;
54 static void ext4_mb_poll_new_transaction(struct super_block *sb,