From 6c22eb7085d3ee055a178ed0a4e8d0e5d18800f3 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Sun, 9 Oct 2022 01:08:51 -0400 Subject: [PATCH] bcachefs: Fix "multiple types of data in same bucket" with ec Signed-off-by: Kent Overstreet --- fs/bcachefs/buckets.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index f01b8171cb92..4b041707cd54 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -687,6 +687,10 @@ static int check_bucket_ref(struct bch_fs *c, if (bucket_data_type == BCH_DATA_cached) bucket_data_type = BCH_DATA_user; + if ((bucket_data_type == BCH_DATA_stripe && ptr_data_type == BCH_DATA_user) || + (bucket_data_type == BCH_DATA_user && ptr_data_type == BCH_DATA_stripe)) + bucket_data_type = ptr_data_type = BCH_DATA_stripe; + if (gen_after(ptr->gen, b_gen)) { bch2_fsck_err(c, FSCK_CAN_IGNORE|FSCK_NEED_FSCK, "bucket %u:%zu gen %u data type %s: ptr gen %u newer than bucket gen\n"