• Filipe Manana's avatar
    Btrfs: make tree checker detect checksum items with overlapping ranges · ad1d8c43
    Filipe Manana authored
    Having checksum items, either on the checksums tree or in a log tree, that
    represent ranges that overlap each other is a sign of a corruption. Such
    case confuses the checksum lookup code and can result in not being able to
    find checksums or find stale checksums.
    
    So add a check for such case.
    
    This is motivated by a recent fix for a case where a log tree had checksum
    items covering ranges that overlap each other due to extent cloning, and
    resulted in missing checksums after replaying the log tree. It also helps
    detect past issues such as stale and outdated checksums due to overlapping,
    commit 27b9a812 ("Btrfs: fix csum tree corruption, duplicate and
    outdated checksums").
    
    CC: stable@vger.kernel.org # 4.4+
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ad1d8c43
tree-checker.c 47.6 KB