From b858e3b5c2df08271505dffdb468b899fc457d0c Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Tue, 11 Aug 2020 19:44:49 +0800 Subject: [PATCH] btrfs-progs: check/original: don't reset extent generation for check_block In check_block(), we unconditionally reset extent_record::generation. This is in fact correct, but this makes original mode fail to detect bad extent item generation. So change to behavior to set the generation if and only if the tree block generation is higher. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- check/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/check/main.c b/check/main.c index 69a47b31..e88e7277 100644 --- a/check/main.c +++ b/check/main.c @@ -4455,7 +4455,8 @@ static int check_block(struct btrfs_root *root, if (!cache) return 1; rec = container_of(cache, struct extent_record, cache); - rec->generation = btrfs_header_generation(buf); + if (rec->generation < btrfs_header_generation(buf)) + rec->generation = btrfs_header_generation(buf); level = btrfs_header_level(buf); if (btrfs_header_nritems(buf) > 0) {