]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: add one more sanity check for shared ref type
authorLiu Bo <bo.li.liu@oracle.com>
Fri, 18 Aug 2017 21:15:24 +0000 (15:15 -0600)
committerDavid Sterba <dsterba@suse.com>
Mon, 21 Aug 2017 15:47:43 +0000 (17:47 +0200)
commitab450b1dea2aff4b0cc43f6249afdadaf873c860
treedba62d928939249fdb9ba235899bf0d6fa35e078
parentc38a765a382f666acf689f7f9a61d87925f516f9
Btrfs: add one more sanity check for shared ref type

Every shared ref has a parent tree block, which can be get from
btrfs_extent_inline_ref_offset().  And the tree block must be aligned
to the nodesize, so we'd know this inline ref is not valid if this
block's bytenr is not aligned to the nodesize, in which case, most
likely the ref type has been misused.

This adds the above mentioned check and also updates
print_extent_item() called by btrfs_print_leaf() to point out the
invalid ref while printing the tree structure.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c
fs/btrfs/print-tree.c