summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-07-27 18:01:52 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:09 -0400
commitb4e09b351be7085cada5c08c1eabee5f0eb498b0 (patch)
tree5d3bdc773b866d96247a82fa0d5e0648a589b0d6 /fs
parente5af273fcefb13cdd9e3c27d9ee6c52ee6b12264 (diff)
downloadlwn-b4e09b351be7085cada5c08c1eabee5f0eb498b0.tar.gz
lwn-b4e09b351be7085cada5c08c1eabee5f0eb498b0.zip
bcachefs: bch2_btree_iter_traverse() shouldn't normally call traverse_all()
If there's more than one iterator in the btree_trans, it's requried to call bch2_trans_begin() to handle transaction restarts. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/btree_iter.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 816b9369c833..ac7a7c18ebe2 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -1476,8 +1476,10 @@ static int __must_check __bch2_btree_iter_traverse(struct btree_iter *iter)
ret = bch2_trans_cond_resched(trans) ?:
btree_iter_traverse_one(iter, _RET_IP_);
- if (unlikely(ret))
+ if (unlikely(ret) && hweight64(trans->iters_linked) == 1) {
ret = __btree_iter_traverse_all(trans, ret, _RET_IP_);
+ BUG_ON(ret == -EINTR);
+ }
return ret;
}