summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-08-10 20:22:01 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-08-11 17:32:32 -0400
commit4b06f6589e19f29277e38cf4a2cdd986d1d1ee5b (patch)
tree8aecd82fa4cd4f5c300ba5bdb35b7bc3f804ac56
parent94658cd99149cff0d978d8b29301496b60a3e678 (diff)
bcachefs: "Snapshot deletion did not run correctly" should be a fsck err
This was noticed when a test hit this error and didn't fail, because fsck wasn't returning that it fixed errors. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
-rw-r--r--fs/bcachefs/fsck.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index bb8cab7cb405..c93e177a314f 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -519,7 +519,7 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s,
.id = pos.snapshot,
.equiv = bch2_snapshot_equiv(c, pos.snapshot),
};
- int ret;
+ int ret = 0;
if (bkey_cmp(s->pos, pos))
s->ids.nr = 0;
@@ -529,14 +529,13 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s,
darray_for_each(s->ids, i)
if (i->equiv == n.equiv) {
- if (i->id != n.id) {
- bch_err(c, "snapshot deletion did not run correctly:\n"
+ if (fsck_err_on(i->id != n.id, c,
+ "snapshot deletion did not run correctly:\n"
" duplicate keys in btree %s at %llu:%llu snapshots %u, %u (equiv %u)\n",
bch2_btree_ids[btree_id],
pos.inode, pos.offset,
- i->id, n.id, n.equiv);
+ i->id, n.id, n.equiv))
return -BCH_ERR_need_snapshot_cleanup;
- }
return 0;
}
@@ -545,6 +544,7 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s,
if (ret)
bch_err(c, "error reallocating snapshots_seen table (size %zu)",
s->ids.size);
+fsck_err:
return ret;
}