diff options
author | Alex Tomas <alex@clusterfs.com> | 2007-05-24 13:04:25 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-05-31 16:20:15 -0400 |
commit | 315054f023d28ee64f308adf8b5737831541776b (patch) | |
tree | 09d40287fdde6f6e46ad578f9810e30933c7594c /fs | |
parent | 25d14f983f70ddbeb15fa2d0f32f6b70bca42a15 (diff) |
When ext4_ext_insert_extent() fails to insert new blocks
we should free just the allocated blocks.
Signed-off-by: Alex Tomas <alex@clusterfs.com>
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | 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 03c777abf01f..b9ce24129070 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, | |||
2099 | ext4_ext_store_pblock(&newex, newblock); | 2099 | ext4_ext_store_pblock(&newex, newblock); |
2100 | newex.ee_len = cpu_to_le16(allocated); | 2100 | newex.ee_len = cpu_to_le16(allocated); |
2101 | err = ext4_ext_insert_extent(handle, inode, path, &newex); | 2101 | err = ext4_ext_insert_extent(handle, inode, path, &newex); |
2102 | if (err) | 2102 | if (err) { |
2103 | /* free data blocks we just allocated */ | ||
2104 | ext4_free_blocks(handle, inode, ext_pblock(&newex), | ||
2105 | le16_to_cpu(newex.ee_len)); | ||
2103 | goto out2; | 2106 | goto out2; |
2107 | } | ||
2104 | 2108 | ||
2105 | if (extend_disksize && inode->i_size > EXT4_I(inode)->i_disksize) | 2109 | if (extend_disksize && inode->i_size > EXT4_I(inode)->i_disksize) |
2106 | EXT4_I(inode)->i_disksize = inode->i_size; | 2110 | EXT4_I(inode)->i_disksize = inode->i_size; |