bcachefs: Fix an assertion when rebuilding replicas
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 4 Nov 2018 02:00:50 +0000 (22:00 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:11 +0000 (17:08 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/extents.c
fs/bcachefs/recovery.c

index 4a62eefd40cdbc3814cd1f91ba88bb77f92e30ef..e2bb1502eaad7a8a9b45cebdadb52bb37a75e892 100644 (file)
@@ -679,7 +679,8 @@ void bch2_btree_ptr_debugcheck(struct bch_fs *c, struct btree *b,
                        goto err;
        }
 
-       if (!bch2_bkey_replicas_marked(c, btree_node_type(b), e.s_c)) {
+       if (!test_bit(BCH_FS_REBUILD_REPLICAS, &c->flags) &&
+           !bch2_bkey_replicas_marked(c, btree_node_type(b), e.s_c)) {
                bch2_bkey_val_to_text(c, btree_node_type(b),
                                     buf, sizeof(buf), k);
                bch2_fs_bug(c,
@@ -1713,7 +1714,8 @@ static void bch2_extent_debugcheck_extent(struct bch_fs *c, struct btree *b,
                return;
        }
 
-       if (!bch2_bkey_replicas_marked(c, btree_node_type(b), e.s_c)) {
+       if (!test_bit(BCH_FS_REBUILD_REPLICAS, &c->flags) &&
+           !bch2_bkey_replicas_marked(c, btree_node_type(b), e.s_c)) {
                bch2_bkey_val_to_text(c, btree_node_type(b),
                                     buf, sizeof(buf), e.s_c);
                bch2_fs_bug(c,
index 2fd68a39d76a34514c8371f133143ed8a6b604de..e21551e8d6cc5b04e066b42bef2b89738978b894 100644 (file)
@@ -219,6 +219,8 @@ int bch2_fs_recovery(struct bch_fs *c)
                goto err;
        bch_verbose(c, "mark and sweep done");
 
+       clear_bit(BCH_FS_REBUILD_REPLICAS, &c->flags);
+
        if (c->opts.noreplay)
                goto out;