]> git.baikalelectronics.ru Git - 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)
commit9e97712ea4c555cb6d6c6adfd8fe7fc2514a9e6a
treeed529a5adb4d1c4a730195667ec506533fd37456
parenta9eac434c42b19d59d579fd66b404e61347cbb18
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