summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-07-24 17:43:35 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:09 -0400
commit67b07638f1fab974284846d77cce771fed88ded3 (patch)
treedefc7dcbf197350ade3917f7c94494bd811327ce /fs
parentfe5233979ace0008b2fab4a05be897d449e44094 (diff)
bcachefs: traverse_all() is responsible for clearing should_be_locked
bch2_btree_iter_traverse_all() may loop, and it needs to clear iter->should_be_locked on every iteration. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/btree_iter.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index a78bdcda2467..2a649166c042 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1249,7 +1249,6 @@ static int __btree_iter_traverse_all(struct btree_trans *trans, int ret,
struct btree_iter *iter;
u8 sorted[BTREE_ITER_MAX];
int i, nr_sorted = 0;
- bool relock_fail;
if (trans->in_traverse_all)
return -EINTR;
@@ -1257,17 +1256,10 @@ static int __btree_iter_traverse_all(struct btree_trans *trans, int ret,
trans->in_traverse_all = true;
retry_all:
nr_sorted = 0;
- relock_fail = false;
trans_for_each_iter(trans, iter) {
- if (!bch2_btree_iter_relock(iter, _THIS_IP_))
- relock_fail = true;
sorted[nr_sorted++] = iter->idx;
- }
-
- if (!relock_fail) {
- trans->in_traverse_all = false;
- return 0;
+ iter->should_be_locked = false;
}
#define btree_iter_cmp_by_idx(_l, _r) \
@@ -2372,11 +2364,9 @@ void bch2_trans_reset(struct btree_trans *trans, unsigned flags)
{
struct btree_iter *iter;
- trans_for_each_iter(trans, iter) {
+ trans_for_each_iter(trans, iter)
iter->flags &= ~(BTREE_ITER_KEEP_UNTIL_COMMIT|
BTREE_ITER_SET_POS_AFTER_COMMIT);
- iter->should_be_locked = false;
- }
bch2_trans_unlink_iters(trans);