Message ID | d5f7aa7b21a238ddbbe4196d9c5707846550728f.1692800798.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: a couple fixes | expand |
diff --git a/kernel-shared/locking.c b/kernel-shared/locking.c index a41ce06b..bd24571e 100644 --- a/kernel-shared/locking.c +++ b/kernel-shared/locking.c @@ -5,15 +5,18 @@ struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root) { + root->node->refs++; return root->node; } struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root) { + root->node->refs++; return root->node; } struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root) { + root->node->refs++; return root->node; }
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 <josef@toxicpanda.com> --- kernel-shared/locking.c | 3 +++ 1 file changed, 3 insertions(+)