OSDN Git Service

Btrfs: make tree checker detect checksum items with overlapping ranges
authorFilipe Manana <fdmanana@suse.com>
Mon, 2 Dec 2019 11:01:03 +0000 (11:01 +0000)
committerDavid Sterba <dsterba@suse.com>
Fri, 13 Dec 2019 13:09:25 +0000 (14:09 +0100)
commitad1d8c439978ede77cbf73cbdd11bafe810421a5
treef6ed5e33639d053fd38827d2c2c12d6d8bbbbfe7
parent40e046acbd2f369cfbf93c3413639c66514cec2d
Btrfs: make tree checker detect checksum items with overlapping ranges

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 27b9a8122ff71a ("Btrfs: fix csum tree corruption, duplicate and
outdated checksums").

CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/tree-checker.c