btrfs: handle csum lookup errors properly on reads
authorJosef Bacik <josef@toxicpanda.com>
Thu, 10 Feb 2022 22:44:20 +0000 (17:44 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 15 Feb 2022 15:55:32 +0000 (16:55 +0100)
commit79e89e2bc908731f5aded8084f9988c648c3852f
tree6165c7cc0072e1fd4075df12c09b1eed86717d04
parent847778463132480df121f8667bec22871877813f
btrfs: handle csum lookup errors properly on reads

Currently any error we get while trying to lookup csums during reads
shows up as a missing csum, and then on the read completion side we spit
out an error saying there was a csum mismatch and we increase the device
corruption count.

However we could have gotten an EIO from the lookup.  We could also be
inside of a memory constrained container and gotten a ENOMEM while
trying to do the read.  In either case we don't want to make this look
like a file system corruption problem, we want to make it look like the
actual error it is.  Capture any negative value, convert it to the
appropriate blk_sts_t, free the csum array if we have one and bail.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/file-item.c