bcachefs: Fix an assertion

We can end up in a strange situation where a btree_path points to a node
being freed even after pointers to it should have been replaced by
pointers to the new node - if the btree node has been reused since the
pointer to it was created.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet
2021-09-27 01:56:31 -04:00
committed by Kent Overstreet
parent 42d237320e
commit 71ed0056dc

View File

@@ -165,7 +165,8 @@ static void bch2_btree_node_free_inmem(struct btree_trans *trans,
struct btree_path *path;
trans_for_each_path(trans, path)
BUG_ON(path->l[b->c.level].b == b);
BUG_ON(path->l[b->c.level].b == b &&
path->l[b->c.level].lock_seq == b->c.lock.state.seq);
six_lock_write(&b->c.lock, NULL, NULL);