summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-09-27 01:56:31 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:13 -0400
commit71ed0056dc1f03346eabcdaa37272041e5d52fe9 (patch)
treee40d457dade4b905a7241ba936bc8c0dd5bac530 /fs
parent42d237320e9817a94f3a0a2de28156523596b086 (diff)
downloadlinux-stable-71ed0056dc1f03346eabcdaa37272041e5d52fe9.tar.gz
linux-stable-71ed0056dc1f03346eabcdaa37272041e5d52fe9.tar.bz2
linux-stable-71ed0056dc1f03346eabcdaa37272041e5d52fe9.zip
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/bcachefs/btree_update_interior.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c
index 73a79563487d..978bb56275de 100644
--- a/fs/bcachefs/btree_update_interior.c
+++ b/fs/bcachefs/btree_update_interior.c
@@ -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);