aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/bcachefs/btree_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2025-05-22 16:54:31 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2025-05-23 07:59:43 -0400
commit66782b2acbc3291faba7e14d9b22b77a4f3f94e4 (patch)
treede6e328ce55961f78fc69fb0adacda0dee08d526 /fs/bcachefs/btree_locking.h
parentbcachefs: btree_node_locked_type_nowrite() (diff)
downloadwireguard-linux-66782b2acbc3291faba7e14d9b22b77a4f3f94e4.tar.xz
wireguard-linux-66782b2acbc3291faba7e14d9b22b77a4f3f94e4.zip
bcachefs: Fix btree_path_get_locks when not doing trans restart
btree_path_get_locks, on failure, shouldn't unlock if we're not issuing a transaction restart: we might drop locks we're not supposed to (if path->should_be_locked is set). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to '')
-rw-r--r--fs/bcachefs/btree_locking.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index 7e162982de17..63d7e5fb77c8 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -385,9 +385,16 @@ static inline bool bch2_btree_node_relock_notrace(struct btree_trans *trans,
/* upgrade */
-bool bch2_btree_path_upgrade_noupgrade_sibs(struct btree_trans *,
- struct btree_path *, unsigned,
- struct get_locks_fail *);
+bool __bch2_btree_path_upgrade_norestart(struct btree_trans *, struct btree_path *, unsigned);
+
+static inline bool bch2_btree_path_upgrade_norestart(struct btree_trans *trans,
+ struct btree_path *path,
+ unsigned new_locks_want)
+{
+ return new_locks_want > path->locks_want
+ ? __bch2_btree_path_upgrade_norestart(trans, path, new_locks_want)
+ : true;
+}
int __bch2_btree_path_upgrade(struct btree_trans *,
struct btree_path *, unsigned);