bcachefs: Call bch2_inconsistent_error() on missing stripe/indirect extent
authorKent Overstreet <kent.overstreet@gmail.com>
Fri, 30 Apr 2021 02:32:44 +0000 (22:32 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:02 +0000 (17:09 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/buckets.c
fs/bcachefs/io.c

index e6e984587b5d39aa94f01a1a3309e0102979757a..d6f0325affcc5d89796fc8b42166fa5756884ca2 100644 (file)
@@ -902,6 +902,7 @@ static int bch2_mark_stripe_ptr(struct bch_fs *c,
                spin_unlock(&c->ec_stripes_heap_lock);
                bch_err_ratelimited(c, "pointer to nonexistent stripe %llu",
                                    (u64) p.idx);
+               bch2_inconsistent_error(c);
                return -EIO;
        }
 
@@ -1019,6 +1020,7 @@ static int bch2_mark_stripe(struct bch_fs *c,
        if (!m || (old_s && !m->alive)) {
                bch_err_ratelimited(c, "error marking nonexistent stripe %zu",
                                    idx);
+               bch2_inconsistent_error(c);
                return -1;
        }
 
@@ -1503,6 +1505,7 @@ static int bch2_trans_mark_stripe_ptr(struct btree_trans *trans,
                bch2_fs_inconsistent(c,
                        "pointer to nonexistent stripe %llu",
                        (u64) p.ec.idx);
+               bch2_inconsistent_error(c);
                ret = -EIO;
                goto out;
        }
@@ -1743,6 +1746,7 @@ static int __bch2_trans_mark_reflink_p(struct btree_trans *trans,
                bch2_fs_inconsistent(c,
                        "%llu:%llu len %u points to nonexistent indirect extent %llu",
                        p.k->p.inode, p.k->p.offset, p.k->size, idx);
+               bch2_inconsistent_error(c);
                ret = -EIO;
                goto err;
        }
index 9c46f67c0d8e6d5d38f0459f297fbfc0b575d834..1e0effcece7f75da1f907dcb806378c298e2fadd 100644 (file)
@@ -1960,6 +1960,7 @@ int __bch2_read_indirect_extent(struct btree_trans *trans,
            k.k->type != KEY_TYPE_indirect_inline_data) {
                bch_err_inum_ratelimited(trans->c, orig_k->k->k.p.inode,
                                "pointer to nonexistent indirect extent");
+               bch2_inconsistent_error(trans->c);
                ret = -EIO;
                goto err;
        }