ext4_extent: return immediately when ext4_ext_correct_indexes fails.
authorngkaho1234 <ngkaho1234@gmail.com>
Thu, 4 Feb 2016 15:39:00 +0000 (15:39 +0000)
committerngkaho1234 <ngkaho1234@gmail.com>
Thu, 4 Feb 2016 15:39:00 +0000 (15:39 +0000)
src/ext4_extent.c

index f7fa68b215bc0ea5e89234e11f6a2cfd0a18ac6b..3c0085f82d17d6eb2d092e1791e964e6be9b43b3 100644 (file)
@@ -1424,12 +1424,15 @@ static int ext4_ext_remove_leaf(struct ext4_inode_ref *inode_ref,
 
        eh->entries_count = to_le16(new_entries);
        ext4_ext_dirty(inode_ref, path + depth);
-       if (path[depth].extent == EXT_FIRST_EXTENT(eh) && eh->entries_count)
+       if (path[depth].extent == EXT_FIRST_EXTENT(eh) && eh->entries_count) {
                err = ext4_ext_correct_indexes(inode_ref, path);
+               if (err != EOK)
+                       return err;
+       }
 
        /* if this leaf is free, then we should
         * remove it from index block above */
-       if (err == EOK && eh->entries_count == 0 && path[depth].block.lb_id)
+       if (eh->entries_count == 0 && path[depth].block.lb_id)
                err = ext4_ext_remove_idx(inode_ref, path, depth - 1);
        else if (depth > 0)
                path[depth - 1].index++;