Skip to content

Commit

Permalink
btrfs: fix an error handling path in btrfs_defrag_leaves()
Browse files Browse the repository at this point in the history
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 <christophe.jaillet@wanadoo.fr>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Christophe JAILLET authored and David Sterba committed Dec 15, 2022
1 parent abe3bf7 commit db0a4a7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fs/btrfs/defrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,10 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
goto out;

path = btrfs_alloc_path();
if (!path)
return -ENOMEM;
if (!path) {
ret = -ENOMEM;
goto out;
}

level = btrfs_header_level(root->node);

Expand Down

0 comments on commit db0a4a7

Please sign in to comment.