Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=315054f023d28ee64f308adf8b5737831541776b
Commit:     315054f023d28ee64f308adf8b5737831541776b
Parent:     25d14f983f70ddbeb15fa2d0f32f6b70bca42a15
Author:     Alex Tomas <[EMAIL PROTECTED]>
AuthorDate: Thu May 24 13:04:25 2007 -0400
Committer:  Theodore Ts'o <[EMAIL PROTECTED]>
CommitDate: Thu May 31 16:20:15 2007 -0400

    When ext4_ext_insert_extent() fails to insert new blocks
    
    we should free just the allocated blocks.
    
    Signed-off-by: Alex Tomas <[EMAIL PROTECTED]>
    Signed-off-by: Mingming Cao <[EMAIL PROTECTED]>
    Signed-off-by: "Theodore Ts'o" <[EMAIL PROTECTED]>
---
 fs/ext4/extents.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 03c777a..b9ce241 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2099,8 +2099,12 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode 
*inode,
        ext4_ext_store_pblock(&newex, newblock);
        newex.ee_len = cpu_to_le16(allocated);
        err = ext4_ext_insert_extent(handle, inode, path, &newex);
-       if (err)
+       if (err) {
+               /* free data blocks we just allocated */
+               ext4_free_blocks(handle, inode, ext_pblock(&newex),
+                                       le16_to_cpu(newex.ee_len));
                goto out2;
+       }
 
        if (extend_disksize && inode->i_size > EXT4_I(inode)->i_disksize)
                EXT4_I(inode)->i_disksize = inode->i_size;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to