From ba01aadff18423a3e5f358867882a40f66ce1b08 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 23 Aug 2023 10:27:48 -0400 Subject: [PATCH] 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 Signed-off-by: David Sterba --- kernel-shared/locking.c | 3 +++ 1 file changed, 3 insertions(+) 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; }