summaryrefslogtreecommitdiff
path: root/fs/bcachefs/disk_accounting.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2024-09-26 22:58:02 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2024-09-28 04:46:35 +0300
commitf8911ad88de3acea7a67451f59649bb54da0741b (patch)
treed544a2bc65e02955aa5b86d97d23b56c5e5245b7 /fs/bcachefs/disk_accounting.c
parentcf49f8a8c277f9f2b78e2a56189a741a508a9820 (diff)
downloadlinux-f8911ad88de3acea7a67451f59649bb54da0741b.tar.xz
bcachefs: Check for accounting keys with bversion=0
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/disk_accounting.c')
-rw-r--r--fs/bcachefs/disk_accounting.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/disk_accounting.c b/fs/bcachefs/disk_accounting.c
index 9ac45a607b93..59897b347c62 100644
--- a/fs/bcachefs/disk_accounting.c
+++ b/fs/bcachefs/disk_accounting.c
@@ -134,6 +134,10 @@ int bch2_accounting_validate(struct bch_fs *c, struct bkey_s_c k,
void *end = &acc_k + 1;
int ret = 0;
+ bkey_fsck_err_on(bversion_zero(k.k->bversion),
+ c, accounting_key_version_0,
+ "accounting key with version=0");
+
switch (acc_k.type) {
case BCH_DISK_ACCOUNTING_nr_inodes:
end = field_end(acc_k, nr_inodes);