From dd7d7f29a7c77d02264097e7b42073a902765c49 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Mon, 9 Dec 2024 06:00:33 -0500 Subject: [PATCH] bcachefs: Don't start rewriting btree nodes until after journal replay Signed-off-by: Kent Overstreet --- fs/bcachefs/btree_update_interior.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/bcachefs/btree_update_interior.c b/fs/bcachefs/btree_update_interior.c index 7d9dab95bdcf..03a6eba7403d 100644 --- a/fs/bcachefs/btree_update_interior.c +++ b/fs/bcachefs/btree_update_interior.c @@ -2291,7 +2291,8 @@ void bch2_btree_node_rewrite_async(struct bch_fs *c, struct btree *b) bool now = false, pending = false; spin_lock(&c->btree_node_rewrites_lock); - if (bch2_write_ref_tryget(c, BCH_WRITE_REF_node_rewrite)) { + if (c->curr_recovery_pass > BCH_RECOVERY_PASS_journal_replay && + bch2_write_ref_tryget(c, BCH_WRITE_REF_node_rewrite)) { list_add(&a->list, &c->btree_node_rewrites); now = true; } else if (!test_bit(BCH_FS_may_go_rw, &c->flags)) {