Skip to content

Commit dd27621

Browse files
loemrawkdave
authored andcommitted
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]>
1 parent c769be2 commit dd27621

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/btrfs/delayed-inode.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,10 @@ static int btrfs_wq_run_delayed_node(struct btrfs_delayed_root *delayed_root,
13771377

13781378
void btrfs_assert_delayed_root_empty(struct btrfs_fs_info *fs_info)
13791379
{
1380-
WARN_ON(btrfs_first_delayed_node(fs_info->delayed_root));
1380+
struct btrfs_delayed_node *node = btrfs_first_delayed_node(fs_info->delayed_root);
1381+
1382+
if (WARN_ON(node))
1383+
refcount_dec(&node->refs);
13811384
}
13821385

13831386
static bool could_end_wait(struct btrfs_delayed_root *delayed_root, int seq)

0 commit comments

Comments
 (0)