]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: warn if leaking delayed_nodes in btrfs_put_root()
authorLeo Martins <loemra.dev@gmail.com>
Wed, 28 May 2025 00:04:22 +0000 (17:04 -0700)
committerDavid Sterba <dsterba@suse.com>
Thu, 19 Jun 2025 13:18:39 +0000 (15:18 +0200)
Add a warning for leaked delayed_nodes when putting a root. We currently
do this for inodes, but not delayed_nodes.

Signed-off-by: Leo Martins <loemra.dev@gmail.com>
Reviewed-by: Filipe Manana <fdmanana@suse.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>
fs/btrfs/disk-io.c

index 1beb9458f622a1734203793a0f60d23c288e5bb9..3def930169638cf949f3942cfcc7737f13702766 100644 (file)
@@ -1835,6 +1835,8 @@ void btrfs_put_root(struct btrfs_root *root)
        if (refcount_dec_and_test(&root->refs)) {
                if (WARN_ON(!xa_empty(&root->inodes)))
                        xa_destroy(&root->inodes);
+               if (WARN_ON(!xa_empty(&root->delayed_nodes)))
+                       xa_destroy(&root->delayed_nodes);
                WARN_ON(test_bit(BTRFS_ROOT_DEAD_RELOC_TREE, &root->state));
                if (root->anon_dev)
                        free_anon_bdev(root->anon_dev);