aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/extents.c
diff options
context:
space:
mode:
authorJiaying Zhang <jiayingz@google.com>2011-07-10 20:07:25 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-04 21:58:39 -0700
commitfac04f94c7b94ef1c62490b176b77f2572086629 (patch)
tree0ee08649e07d88699814c79db39286907ef9eab9 /fs/ext4/extents.c
parent99cdf2a47f443985d956e02323331819898d99b7 (diff)
downloadkernel_samsung_smdk4412-fac04f94c7b94ef1c62490b176b77f2572086629.zip
kernel_samsung_smdk4412-fac04f94c7b94ef1c62490b176b77f2572086629.tar.gz
kernel_samsung_smdk4412-fac04f94c7b94ef1c62490b176b77f2572086629.tar.bz2
ext4: free allocated and pre-allocated blocks when check_eofblocks_fl fails
commit 575a1d4bdfa2ea9fc10733013136145b497e1be0 upstream. Upon corrupted inode or disk failures, we may fail after we already allocate some blocks from the inode or take some blocks from the inode's preallocation list, but before we successfully insert the corresponding extent to the extent tree. In this case, we should free any allocated blocks and discard the inode's preallocated blocks because the entries in the inode's preallocation list may be in an inconsistent state. Signed-off-by: Jiaying Zhang <jiayingz@google.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/ext4/extents.c')
-rw-r--r--fs/ext4/extents.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 4bc4084..f3aacb3 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3596,10 +3596,9 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
}
err = check_eofblocks_fl(handle, inode, map->m_lblk, path, ar.len);
- if (err)
- goto out2;
-
- err = ext4_ext_insert_extent(handle, inode, path, &newex, flags);
+ if (!err)
+ err = ext4_ext_insert_extent(handle, inode, path,
+ &newex, flags);
if (err) {
int fb_flags = flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE ?
EXT4_FREE_BLOCKS_NO_QUOT_UPDATE : 0;