diff options
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. |