summaryrefslogtreecommitdiff
path: root/fs/bcachefs/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/bcachefs/ec.c')
-rw-r--r--fs/bcachefs/ec.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c
index c2840cb674b2..c93a4f90a90f 100644
--- a/fs/bcachefs/ec.c
+++ b/fs/bcachefs/ec.c
@@ -1767,7 +1767,14 @@ static int __get_existing_stripe(struct btree_trans *trans,
{
struct bch_fs *c = trans->c;
- CLASS(btree_iter, iter)(trans, BTREE_ID_stripes, POS(0, idx), BTREE_ITER_nopreserve);
+ /*
+ * We require an intent lock here until we have the stripe open, for
+ * exclusion with bch2_trigger_stripe() - which will delete empty
+ * stripes if they're not open, but it can't actually open them:
+ */
+ CLASS(btree_iter, iter)(trans, BTREE_ID_stripes, POS(0, idx),
+ BTREE_ITER_intent|
+ BTREE_ITER_nopreserve);
struct bkey_s_c k = bch2_btree_iter_peek_slot(&iter);
int ret = bkey_err(k);
if (ret)