OSDN Git Service

btrfs: tree-checker: Add ROOT_ITEM check
authorQu Wenruo <wqu@suse.com>
Tue, 16 Jul 2019 09:00:34 +0000 (17:00 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 9 Sep 2019 12:59:01 +0000 (14:59 +0200)
commit259ee7754b6793af8bdd77f9ca818bc41cfe9541
tree1df9c3d63c8245a1577e546e6c789faf1baba30d
parent2a28468e525f3924efed7f29f2bc5a2926e7e19a
btrfs: tree-checker: Add ROOT_ITEM check

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>
fs/btrfs/tree-checker.c