Skip to content

Commit 3f54247

Browse files
zhanchengbintytso
authored andcommitted
ext4: fix inode tree inconsistency caused by ENOMEM
If ENOMEM fails when the extent is splitting, we need to restore the length of the split extent. In the ext4_split_extent_at function, only in ext4_ext_create_new_leaf will it alloc memory and change the shape of the extent tree,even if an ENOMEM is returned at this time, the extent tree is still self-consistent, Just restore the split extent lens in the function ext4_split_extent_at. ext4_split_extent_at ext4_ext_insert_extent ext4_ext_create_new_leaf 1)ext4_ext_split ext4_find_extent 2)ext4_ext_grow_indepth ext4_find_extent Signed-off-by: zhanchengbin <[email protected]> Reviewed-by: Jan Kara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent f31173c commit 3f54247

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ext4/extents.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3251,7 +3251,7 @@ static int ext4_split_extent_at(handle_t *handle,
32513251
ext4_ext_mark_unwritten(ex2);
32523252

32533253
err = ext4_ext_insert_extent(handle, inode, ppath, &newex, flags);
3254-
if (err != -ENOSPC && err != -EDQUOT)
3254+
if (err != -ENOSPC && err != -EDQUOT && err != -ENOMEM)
32553255
goto out;
32563256

32573257
if (EXT4_EXT_MAY_ZEROOUT & split_flag) {

0 commit comments

Comments
 (0)