summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Tintel <stijn@linux-ipv6.be>2021-05-24 15:56:57 +0300
committerStijn Tintel <stijn@linux-ipv6.be>2021-05-24 18:39:38 +0300
commitec818eb29fab6b45a8d133ff3d503dcf9ffa5f01 (patch)
tree8d6548cdc7693ce5b36aea918f1d6d1227176d49
parent910e54c139359d68f6ab01ac249dd9a40a9bee6b (diff)
Revert "bcachefs: Drop all btree locks when submitting btree node reads"bcachefs-v5.10
Causes infinite loop when btree node read is called from traverse_all. This reverts commit 3e47b2a78e897a37a41ffefaa8a86878a178dc2d.
-rw-r--r--fs/bcachefs/btree_cache.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index 1c2c1d67676c..f6adbe8955d7 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -654,9 +654,13 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c,
return NULL;
}
- /* Unlock before doing IO: */
- if (iter && sync)
- bch2_trans_unlock(iter->trans);
+ /*
+ * Unlock before doing IO:
+ *
+ * XXX: ideally should be dropping all btree node locks here
+ */
+ if (iter && btree_node_read_locked(iter, level + 1))
+ btree_node_unlock(iter, level + 1);
bch2_btree_node_read(c, b, sync);
@@ -667,16 +671,6 @@ static noinline struct btree *bch2_btree_node_fill(struct bch_fs *c,
return NULL;
}
- /*
- * XXX: this will probably always fail because btree_iter_relock()
- * currently fails for iterators that aren't pointed at a valid btree
- * node
- */
- if (iter && !bch2_trans_relock(iter->trans)) {
- six_unlock_intent(&b->c.lock);
- return ERR_PTR(-EINTR);
- }
-
if (lock_type == SIX_LOCK_read)
six_lock_downgrade(&b->c.lock);
@@ -818,22 +812,9 @@ lock_node:
}
}
- if (unlikely(btree_node_read_in_flight(b))) {
- six_unlock_type(&b->c.lock, lock_type);
- bch2_trans_unlock(iter->trans);
-
- wait_on_bit_io(&b->flags, BTREE_NODE_read_in_flight,
- TASK_UNINTERRUPTIBLE);
-
- /*
- * XXX: check if this always fails - btree_iter_relock()
- * currently fails for iterators that aren't pointed at a valid
- * btree node
- */
- if (iter && !bch2_trans_relock(iter->trans))
- return ERR_PTR(-EINTR);
- goto retry;
- }
+ /* XXX: waiting on IO with btree locks held: */
+ wait_on_bit_io(&b->flags, BTREE_NODE_read_in_flight,
+ TASK_UNINTERRUPTIBLE);
prefetch(b->aux_data);