While scrubbing superblocks we will check every superblock's checksum and generation. However, checking superblock's generation may cause some problems, this is because tree log sync only flush first superblock , while this will cause other superblocks' generation mismatch.
We only report superblock generation mismatch if it is first superblock or we make sure we are not doing tree log. Reported-by: Sebastian Ochmann <[email protected]> Signed-off-by: Wang Shilong <[email protected]> Reviewed-by: Miao Xie <[email protected]> --- fs/btrfs/scrub.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 2544805..b29a91f 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -1794,8 +1794,15 @@ static int scrub_checksum_super(struct scrub_block *sblock) if (sblock->pagev[0]->logical != btrfs_super_bytenr(s)) ++fail_cor; - if (sblock->pagev[0]->generation != btrfs_super_generation(s)) - ++fail_gen; + if (sblock->pagev[0]->generation != btrfs_super_generation(s)) { + /* + * we only report a generation mismatch if this is first + * superblock or we can make sure we are not doing tree log. + */ + if (btrfs_super_bytenr(s) == btrfs_sb_offset(0) || + !root->fs_info->log_root_tree) + ++fail_gen; + } if (memcmp(s->fsid, fs_info->fsid, BTRFS_UUID_SIZE)) ++fail_cor; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
