btrfs: fix delayed ref refcount leak in debug assertion

If the delayed_root is not empty we are increasing the number of
references to a delayed_node without decreasing it, causing a leak.  Fix
by decrementing the delayed_node reference count.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Leo Martins <loemra.dev@gmail.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
[ Remove the changelog from the commit message. ]
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Leo Martins
2025-05-27 17:04:21 -07:00
committed by David Sterba
parent c769be2d3d
commit dd276214e4
+4 -1
View File
@@ -1377,7 +1377,10 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root,
void btrfs_assert_delayed_root_empty(struct btrfs_fs_info *fs_info)
{
WARN_ON(btrfs_first_delayed_node(fs_info->delayed_root));
struct btrfs_delayed_node *node = btrfs_first_delayed_node(fs_info->delayed_root);
if (WARN_ON(node))
refcount_dec(&node->refs);
}
static bool could_end_wait(struct btrfs_delayed_root *delayed_root, int seq)