aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/delayed-inode.c
diff options
context:
space:
mode:
authorLeo Martins <[email protected]>2025-05-28 00:04:21 +0000
committerDavid Sterba <[email protected]>2025-06-19 13:18:35 +0000
commitdd276214e439db08f444fd3e07e9fe4c9e0ca210 (patch)
tree11084fb8f0314339653114bd6fbe49297ed70a84 /fs/btrfs/delayed-inode.c
parentbtrfs: include root in error message when unlinking inode (diff)
downloadkernel-dd276214e439db08f444fd3e07e9fe4c9e0ca210.tar.gz
kernel-dd276214e439db08f444fd3e07e9fe4c9e0ca210.zip
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 <[email protected]> Signed-off-by: Leo Martins <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> [ Remove the changelog from the commit message. ] Signed-off-by: Qu Wenruo <[email protected]> Signed-off-by: David Sterba <[email protected]>
Diffstat (limited to 'fs/btrfs/delayed-inode.c')
-rw-r--r--fs/btrfs/delayed-inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/delayed-inode.c b/fs/btrfs/delayed-inode.c
index c7cc24a5dd5e..8c597fa60523 100644
--- a/fs/btrfs/delayed-inode.c
+++ b/fs/btrfs/delayed-inode.c
@@ -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)