btrfs-progs: fsck: Check if a metadata tree block crossing stripe boundary
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Thu, 23 Jul 2015 09:18:08 +0000 (17:18 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 31 Aug 2015 17:25:10 +0000 (19:25 +0200)
commit595c57d2f4dd3199aacb23b4c68d6aff49f97d29
tree5a417bbf5a482dc7fbd30254e4286382b63c655e
parent045dc8fb6cb41bc804af3069f76ac3c94681ea42
btrfs-progs: fsck: Check if a metadata tree block crossing stripe boundary

Kernel btrfs_map_block() function has a limitation that it can only
map BTRFS_STRIPE_LEN size.
That will cause scrub fails to scrub tree block which crosses strip
boundary, causing BUG_ON().

Normally, it's OK as metadata is always in metadata chunk and
BTRFS_STRIPE_LEN can always be divided by node/leaf size.
So without mixed block group, tree block won't cross stripe boundary.

But for mixed block group, especially for btrfs converted from ext4,
it's almost sure one or more tree blocks are not aligned with node size
and cross stripe boundary.
Causing bug with kernel scrub.

This patch will report the problem, although we don't have a good idea
how to fix it in user space until we add the ability to relocate tree
block in user space.

Also, kernel code should also be checked for such tree block alloc
problems.

Reported-by: Chris Murphy <lists@colorremedies.com>
Reported-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c
volumes.h