36 lines
1.2 KiB
Diff
36 lines
1.2 KiB
Diff
From ce612d0d48ce2143fc0394c7fbf5eb1f5944a25f Mon Sep 17 00:00:00 2001
|
|
From: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Date: Sun, 20 Oct 2024 19:02:44 -0400
|
|
Subject: [PATCH 031/233] bcachefs: Add version check for
|
|
bch_btree_ptr_v2.sectors_written validate
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
A user popped up with a very old (0.11) filesystem that needed repair
|
|
and wasn't recently backed up.
|
|
|
|
Reported-by: Manoa <manoa@mail.com>
|
|
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
|
---
|
|
fs/bcachefs/extents.c | 3 ++-
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
|
|
index 37e3d69bec06..85b98c782e1b 100644
|
|
--- a/fs/bcachefs/extents.c
|
|
+++ b/fs/bcachefs/extents.c
|
|
@@ -203,7 +203,8 @@ int bch2_btree_ptr_v2_validate(struct bch_fs *c, struct bkey_s_c k,
|
|
c, btree_ptr_v2_min_key_bad,
|
|
"min_key > key");
|
|
|
|
- if (flags & BCH_VALIDATE_write)
|
|
+ if ((flags & BCH_VALIDATE_write) &&
|
|
+ c->sb.version_min >= bcachefs_metadata_version_btree_ptr_sectors_written)
|
|
bkey_fsck_err_on(!bp.v->sectors_written,
|
|
c, btree_ptr_v2_written_0,
|
|
"sectors_written == 0");
|
|
--
|
|
2.45.2
|
|
|