summaryrefslogtreecommitdiffstats
path: root/fs/bcachefs/btree_locking.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-06 08:58:02 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:41 -0400
commit2ec254c098da677295c2487ae36e75a26d557222 (patch)
treed6c3ffceb92f16978c9e526803a2d8058fa8630b /fs/bcachefs/btree_locking.h
parent0d7009d7ca99ad9261a7cffcecd515108377a6ac (diff)
downloadlinux-stable-2ec254c098da677295c2487ae36e75a26d557222.tar.gz
linux-stable-2ec254c098da677295c2487ae36e75a26d557222.tar.bz2
linux-stable-2ec254c098da677295c2487ae36e75a26d557222.zip
bcachefs: Ensure bch2_btree_node_lock_write_nofail() never fails
In order for bch2_btree_node_lock_write_nofail() to never produce a deadlock, we must ensure we're never holding read locks when using it. Fortunately, it's only used from code paths where any read locks may be safely dropped. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/btree_locking.h')
-rw-r--r--fs/bcachefs/btree_locking.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/fs/bcachefs/btree_locking.h b/fs/bcachefs/btree_locking.h
index 6d8df25bf076..95089693a420 100644
--- a/fs/bcachefs/btree_locking.h
+++ b/fs/bcachefs/btree_locking.h
@@ -290,14 +290,6 @@ static inline int __btree_node_lock_write(struct btree_trans *trans,
: __bch2_btree_node_lock_write(trans, path, b, lock_may_not_fail);
}
-static inline void bch2_btree_node_lock_write_nofail(struct btree_trans *trans,
- struct btree_path *path,
- struct btree_bkey_cached_common *b)
-{
- int ret = __btree_node_lock_write(trans, path, b, true);
- BUG_ON(ret);
-}
-
static inline int __must_check
bch2_btree_node_lock_write(struct btree_trans *trans,
struct btree_path *path,
@@ -306,6 +298,10 @@ bch2_btree_node_lock_write(struct btree_trans *trans,
return __btree_node_lock_write(trans, path, b, false);
}
+void bch2_btree_node_lock_write_nofail(struct btree_trans *,
+ struct btree_path *,
+ struct btree_bkey_cached_common *);
+
/* relock: */
bool bch2_btree_path_relock_norestart(struct btree_trans *,