Commit 9de40d77 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Check for writing btree_ptr_v2.sectors_written == 0

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 60f2b1bc
...@@ -201,6 +201,11 @@ int bch2_btree_ptr_v2_invalid(struct bch_fs *c, struct bkey_s_c k, ...@@ -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, c, err, btree_ptr_v2_min_key_bad,
"min_key > key"); "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); ret = bch2_bkey_ptrs_invalid(c, k, flags, err);
fsck_err: fsck_err:
return ret; return ret;
......
...@@ -272,7 +272,8 @@ ...@@ -272,7 +272,8 @@
x(snapshot_node_missing, 264) \ x(snapshot_node_missing, 264) \
x(dup_backpointer_to_bad_csum_extent, 265) \ x(dup_backpointer_to_bad_csum_extent, 265) \
x(btree_bitmap_not_marked, 266) \ 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 { enum bch_sb_error_id {
#define x(t, n) BCH_FSCK_ERR_##t = n, #define x(t, n) BCH_FSCK_ERR_##t = n,
......
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