diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2012-09-30 23:03:50 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-09-30 23:03:50 -0400 |
commit | 6f2080e64487b9963f9c6ff8a252e1abce98f2d4 (patch) | |
tree | e69e5b706895a52884cfc28f0fc4813c04a08344 /fs/ext4 | |
parent | 02d262dffcf4c74e5c4612ee736bdb94f18ed5b9 (diff) |
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.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index 5920e75fc05f..c1fcf489e056 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, | |||
2589 | struct ext4_ext_path *path = NULL; | 2589 | struct ext4_ext_path *path = NULL; |
2590 | ext4_fsblk_t partial_cluster = 0; | 2590 | ext4_fsblk_t partial_cluster = 0; |
2591 | handle_t *handle; | 2591 | handle_t *handle; |
2592 | int i = 0, err; | 2592 | int i = 0, err = 0; |
2593 | 2593 | ||
2594 | ext_debug("truncate since %u to %u\n", start, end); | 2594 | ext_debug("truncate since %u to %u\n", start, end); |
2595 | 2595 | ||
@@ -2621,12 +2621,16 @@ again: | |||
2621 | return PTR_ERR(path); | 2621 | return PTR_ERR(path); |
2622 | } | 2622 | } |
2623 | depth = ext_depth(inode); | 2623 | depth = ext_depth(inode); |
2624 | /* Leaf not may not exist only if inode has no blocks at all */ | ||
2624 | ex = path[depth].p_ext; | 2625 | ex = path[depth].p_ext; |
2625 | if (!ex) { | 2626 | if (!ex) { |
2626 | ext4_ext_drop_refs(path); | 2627 | if (depth) { |
2627 | kfree(path); | 2628 | EXT4_ERROR_INODE(inode, |
2628 | path = NULL; | 2629 | "path[%d].p_hdr == NULL", |
2629 | goto cont; | 2630 | depth); |
2631 | err = -EIO; | ||
2632 | } | ||
2633 | goto out; | ||
2630 | } | 2634 | } |
2631 | 2635 | ||
2632 | ee_block = le32_to_cpu(ex->ee_block); | 2636 | ee_block = le32_to_cpu(ex->ee_block); |
@@ -2658,8 +2662,6 @@ again: | |||
2658 | goto out; | 2662 | goto out; |
2659 | } | 2663 | } |
2660 | } | 2664 | } |
2661 | cont: | ||
2662 | |||
2663 | /* | 2665 | /* |
2664 | * We start scanning from right side, freeing all the blocks | 2666 | * We start scanning from right side, freeing all the blocks |
2665 | * after i_size and walking into the tree depth-wise. | 2667 | * after i_size and walking into the tree depth-wise. |