summaryrefslogtreecommitdiff
path: root/fs/btrfs/struct-funcs.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2016-09-02 12:35:34 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-16 22:16:07 +0100
commit4b522570f9743b190319768144a52b9907c5d18a (patch)
treeafa386490df89a3b9e9d9b248090c044ad1789f7 /fs/btrfs/struct-funcs.c
parent1ef3ecf373ae2c650894fbfc4de385dde4fd76cb (diff)
Btrfs: fix BUG_ON in btrfs_mark_buffer_dirty
commit ef85b25e982b5bba1530b936e283ef129f02ab9d upstream. This can only happen with CONFIG_BTRFS_FS_CHECK_INTEGRITY=y. Commit 1ba98d0 ("Btrfs: detect corruption when non-root leaf has zero item") assumes that a leaf is its root when leaf->bytenr == btrfs_root_bytenr(root), however, we should not use btrfs_root_bytenr(root) since it's mainly got updated during committing transaction. So the check can fail when doing COW on this leaf while it is a root. This changes to use "if (leaf == btrfs_root_node(root))" instead, just like how we check whether leaf is a root in __btrfs_cow_block(). Fixes: 1ba98d086fe3 (Btrfs: detect corruption when non-root leaf has zero item) Reported-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs/struct-funcs.c')
0 files changed, 0 insertions, 0 deletions