Skip to content

Commit db0a4a7

Browse files
tititiou36kdave
authored andcommitted
btrfs: fix an error handling path in btrfs_defrag_leaves()
All error handling paths end to 'out', except this memory allocation failure. This is spurious. So branch to the error handling path also in this case. It will add a call to: memset(&root->defrag_progress, 0, sizeof(root->defrag_progress)); Fixes: 6702ed4 ("Btrfs: Add run time btree defrag, and an ioctl to force btree defrag") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent abe3bf7 commit db0a4a7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/btrfs/defrag.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,10 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
358358
goto out;
359359

360360
path = btrfs_alloc_path();
361-
if (!path)
362-
return -ENOMEM;
361+
if (!path) {
362+
ret = -ENOMEM;
363+
goto out;
364+
}
363365

364366
level = btrfs_header_level(root->node);
365367

0 commit comments

Comments
 (0)