bcachefs: Check for writing btree_ptr_v2.sectors_written == 0

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2024-04-16 19:33:56 -04:00
parent 60f2b1bcf5
commit 9de40d77f0
2 changed files with 7 additions and 1 deletions

View File

@ -201,6 +201,11 @@ int bch2_btree_ptr_v2_invalid(struct bch_fs *c, struct bkey_s_c k,
c, err, btree_ptr_v2_min_key_bad,
"min_key > key");
if (flags & BKEY_INVALID_WRITE)
bkey_fsck_err_on(!bp.v->sectors_written,
c, err, btree_ptr_v2_written_0,
"sectors_written == 0");
ret = bch2_bkey_ptrs_invalid(c, k, flags, err);
fsck_err:
return ret;

View File

@ -272,7 +272,8 @@
x(snapshot_node_missing, 264) \
x(dup_backpointer_to_bad_csum_extent, 265) \
x(btree_bitmap_not_marked, 266) \
x(sb_clean_entry_overrun, 267)
x(sb_clean_entry_overrun, 267) \
x(btree_ptr_v2_written_0, 268)
enum bch_sb_error_id {
#define x(t, n) BCH_FSCK_ERR_##t = n,