Commit c7be3cb5 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent fa3ae3ca
...@@ -519,7 +519,7 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s, ...@@ -519,7 +519,7 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s,
.id = pos.snapshot, .id = pos.snapshot,
.equiv = bch2_snapshot_equiv(c, pos.snapshot), .equiv = bch2_snapshot_equiv(c, pos.snapshot),
}; };
int ret; int ret = 0;
if (bkey_cmp(s->pos, pos)) if (bkey_cmp(s->pos, pos))
s->ids.nr = 0; s->ids.nr = 0;
...@@ -529,14 +529,13 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s, ...@@ -529,14 +529,13 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s,
darray_for_each(s->ids, i) darray_for_each(s->ids, i)
if (i->equiv == n.equiv) { if (i->equiv == n.equiv) {
if (i->id != n.id) { if (fsck_err_on(i->id != n.id, c,
bch_err(c, "snapshot deletion did not run correctly:\n" "snapshot deletion did not run correctly:\n"
" duplicate keys in btree %s at %llu:%llu snapshots %u, %u (equiv %u)\n", " duplicate keys in btree %s at %llu:%llu snapshots %u, %u (equiv %u)\n",
bch2_btree_ids[btree_id], bch2_btree_ids[btree_id],
pos.inode, pos.offset, pos.inode, pos.offset,
i->id, n.id, n.equiv); i->id, n.id, n.equiv))
return -BCH_ERR_need_snapshot_cleanup; return -BCH_ERR_need_snapshot_cleanup;
}
return 0; return 0;
} }
...@@ -545,6 +544,7 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s, ...@@ -545,6 +544,7 @@ static int snapshots_seen_update(struct bch_fs *c, struct snapshots_seen *s,
if (ret) if (ret)
bch_err(c, "error reallocating snapshots_seen table (size %zu)", bch_err(c, "error reallocating snapshots_seen table (size %zu)",
s->ids.size); s->ids.size);
fsck_err:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment