From d99af4f194d7af8aa11233707826875ef0704034 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Thu, 29 Apr 2021 22:32:44 -0400 Subject: [PATCH] bcachefs: Call bch2_inconsistent_error() on missing stripe/indirect extent Signed-off-by: Kent Overstreet Signed-off-by: Kent Overstreet --- fs/bcachefs/buckets.c | 4 ++++ fs/bcachefs/io.c | 1 + 2 files changed, 5 insertions(+) diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index e6e984587b5d..d6f0325affcc 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -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; } diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c index 9c46f67c0d8e..1e0effcece7f 100644 --- a/fs/bcachefs/io.c +++ b/fs/bcachefs/io.c @@ -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; }