summaryrefslogtreecommitdiff
path: root/fs/ext4
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2012-09-30 23:03:50 -0400
committerTheodore Ts'o <tytso@mit.edu>2012-09-30 23:03:50 -0400
commit6f2080e64487b9963f9c6ff8a252e1abce98f2d4 (patch)
treee69e5b706895a52884cfc28f0fc4813c04a08344 /fs/ext4
parent02d262dffcf4c74e5c4612ee736bdb94f18ed5b9 (diff)
downloadlinux-3.10-6f2080e64487b9963f9c6ff8a252e1abce98f2d4.tar.gz
linux-3.10-6f2080e64487b9963f9c6ff8a252e1abce98f2d4.tar.bz2
linux-3.10-6f2080e64487b9963f9c6ff8a252e1abce98f2d4.zip
ext4: fix ext_remove_space for punch_hole case
Inode is allowed to have empty leaf only if it this is blockless inode. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/extents.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 5920e75fc05..c1fcf489e05 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -2589,7 +2589,7 @@ static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
struct ext4_ext_path *path = NULL;
ext4_fsblk_t partial_cluster = 0;
handle_t *handle;
- int i = 0, err;
+ int i = 0, err = 0;
ext_debug("truncate since %u to %u\n", start, end);
@@ -2621,12 +2621,16 @@ again:
return PTR_ERR(path);
}
depth = ext_depth(inode);
+ /* Leaf not may not exist only if inode has no blocks at all */
ex = path[depth].p_ext;
if (!ex) {
- ext4_ext_drop_refs(path);
- kfree(path);
- path = NULL;
- goto cont;
+ if (depth) {
+ EXT4_ERROR_INODE(inode,
+ "path[%d].p_hdr == NULL",
+ depth);
+ err = -EIO;
+ }
+ goto out;
}
ee_block = le32_to_cpu(ex->ee_block);
@@ -2658,8 +2662,6 @@ again:
goto out;
}
}
-cont:
-
/*
* We start scanning from right side, freeing all the blocks
* after i_size and walking into the tree depth-wise.