]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
btrfs: hold a ref on the root in build_backref_tree
authorJosef Bacik <josef@toxicpanda.com>
Fri, 24 Jan 2020 14:32:38 +0000 (09:32 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 23 Mar 2020 16:01:29 +0000 (17:01 +0100)
commit0b530bc5e11f06da8cb6791d658c3ac2dced2486
treeed529a5adb4d1c4a730195667ec506533fd37456
parent2a2b5d62026633d6fc515b1c0fe3a5e58cae7891
btrfs: hold a ref on the root in build_backref_tree

This is trickier than the previous conversions.  We have backref_node's
that need to hold onto their root for their lifetime.  Do the read of
the root and grab the ref.  If at any point we don't use the root we
discard it, however if we use it in our backref node we don't free it
until we free the backref node.  Any time we switch the root's for the
backref node we need to drop our ref on the old root and grab the ref on
the new root, and if we dupe a node we need to get a ref on the root
there as well.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c