]> git.ipfire.org Git - people/arne_f/kernel.git/commit
btrfs: do not ignore error from btrfs_next_leaf() when inserting checksums
authorFilipe Manana <fdmanana@suse.com>
Mon, 18 May 2020 11:15:09 +0000 (12:15 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Jun 2020 08:25:08 +0000 (10:25 +0200)
commit05c614673a309bae3655af3f4c5d3e8b7b1c97c7
treeb09cda8f071e5357bc0f2fbb7b2ec5c4bce8c9b1
parenta49fdcefa920293883877ed7c2029e242823ace7
btrfs: do not ignore error from btrfs_next_leaf() when inserting checksums

[ Upstream commit 7e4a3f7ed5d54926ec671bbb13e171cfe179cc50 ]

We are currently treating any non-zero return value from btrfs_next_leaf()
the same way, by going to the code that inserts a new checksum item in the
tree. However if btrfs_next_leaf() returns an error (a value < 0), we
should just stop and return the error, and not behave as if nothing has
happened, since in that case we do not have a way to know if there is a
next leaf or we are currently at the last leaf already.

So fix that by returning the error from btrfs_next_leaf().

Signed-off-by: Filipe Manana <fdmanana@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/file-item.c