Skip to content

Commit a9599a3

Browse files
josefbacikkdave
authored andcommitted
btrfs-progs: take a ref in the root locking code
This code in the kernel not only returns the locked root, but also takes a reference on the node. This is important for when we sync ctree.c into btrfs-progs, it expects that references are held on the root node after calling these helpers. Signed-off-by: Josef Bacik <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 5c7d3c7 commit a9599a3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel-shared/locking.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55

66
struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root)
77
{
8+
root->node->refs++;
89
return root->node;
910
}
1011

1112
struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root)
1213
{
14+
root->node->refs++;
1315
return root->node;
1416
}
1517

1618
struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root)
1719
{
20+
root->node->refs++;
1821
return root->node;
1922
}

0 commit comments

Comments
 (0)