]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: make search_csum_tree return 0 if we get -EFBIG
authorJosef Bacik <josef@toxicpanda.com>
Fri, 18 Feb 2022 15:03:22 +0000 (10:03 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:06:36 +0000 (14:06 +0200)
commit3c40052e3fde325cbe9dac4f52a229d74a5f3b8a
treeccc5a3320b6e3774bb3abcbe80e26d93ec91900e
parent0cfccb13cb877b5872b42f46f4453ad916b9fc48
btrfs: make search_csum_tree return 0 if we get -EFBIG

[ Upstream commit 03ddb19d2ea745228879b9334f3b550c88acb10a ]

We can either fail to find a csum entry at all and return -ENOENT, or we
can find a range that is close, but return -EFBIG.  In essence these
both mean the same thing when we are doing a lookup for a csum in an
existing range, we didn't find a csum.  We want to treat both of these
errors the same way, complain loudly that there wasn't a csum.  This
currently happens anyway because we do

count = search_csum_tree();
if (count <= 0) {
// reloc and error handling
}

However it forces us to incorrectly treat EIO or ENOMEM errors as on
disk corruption.  Fix this by returning 0 if we get either -ENOENT or
-EFBIG from btrfs_lookup_csum() so we can do proper error handling.

Reviewed-by: Boris Burkov <boris@bur.io>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.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