shithub: lwext4

Download patch

ref: 2eb1882c69281f7a101aed4c62df1f707fea9a6e
parent: 3e94292dc3da4ee80c088bdbd108d5372dd4e1b5
author: ngkaho1234 <[email protected]>
date: Thu Feb 4 10:39:00 EST 2016

ext4_extent: return immediately when ext4_ext_correct_indexes fails.

--- a/src/ext4_extent.c
+++ b/src/ext4_extent.c
@@ -1424,12 +1424,15 @@
 
 	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++;