]> www.infradead.org Git - users/dwmw2/linux.git/commit
btrfs: tree-checker: Add ROOT_ITEM check
authorQu Wenruo <wqu@suse.com>
Tue, 16 Jul 2019 09:00:34 +0000 (17:00 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2019 11:13:59 +0000 (13:13 +0200)
commit3d95c52d789ca99e344061d7f6dadb2519adbcf5
tree80364b6258dab413519e03d130af87625ad3d421
parent9ae8394e41d79637b9a012ea46edae964e71235c
btrfs: tree-checker: Add ROOT_ITEM check

[ Upstream commit 259ee7754b6793af8bdd77f9ca818bc41cfe9541 ]

This patch will introduce ROOT_ITEM check, which includes:
- Key->objectid and key->offset check
  Currently only some easy check, e.g. 0 as rootid is invalid.

- Item size check
  Root item size is fixed.

- Generation checks
  Generation, generation_v2 and last_snapshot should not be greater than
  super generation + 1

- Level and alignment check
  Level should be in [0, 7], and bytenr must be aligned to sector size.

- Flags check

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203261
Reported-by: Jungyeon Yoon <jungyeon.yoon@gmail.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/tree-checker.c