btrfs: fix an error handling path in btrfs_defrag_leaves()
authorSasha Levin <sashal@kernel.org>
Sun, 8 Jan 2023 13:24:19 +0000 (08:24 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 10:59:08 +0000 (11:59 +0100)
commitd7e817e689b12238901fe0fa20162bf906f954dd
tree7e4571c522b150c692425e75bbd35516ae2cadac
parent4d69cdba2c27c805d474365f6cbc2a3207f058da
btrfs: fix an error handling path in btrfs_defrag_leaves()

[ Upstream commit db0a4a7b8e95f9312a59a67cbd5bc589f090e13d ]

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: 6702ed490ca0 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/tree-defrag.c