summaryrefslogtreecommitdiff
path: root/extent_io.c
diff options
context:
space:
mode:
authorZach Brown <zab@zabbo.net>2014-10-15 16:14:19 -0700
committerDavid Sterba <dsterba@suse.cz>2014-11-03 18:35:30 +0100
commit85d67ac1450ff245af79ac907092fa55eb52fb32 (patch)
tree379c62fee5ee5d0d39fd0ee7ecbfb7b42b3eda0a /extent_io.c
parent9662864435d23ecd4c9f91dd3ab5af2c062ed01f (diff)
btrfs-progs: check read extent errors when mapping
coverity barked out a warning that btrfs-map-logical was storing but ignoring errors from read_extent_from_disk(). So don't ignore 'em. I made extent reading errors fatal to match the fatal errors from mapping mirrors above. And while we're at it have read_extent_from_disk() return -errno pread errors instead of -EIO or -1 (-EPERM). The only other caller who tests errors clobbers them with -EIO. Signed-off-by: Zach Brown <zab@zabbo.net> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'extent_io.c')
-rw-r--r--extent_io.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/extent_io.c b/extent_io.c
index de9e0ecc..9c982f9a 100644
--- a/extent_io.c
+++ b/extent_io.c
@@ -666,8 +666,10 @@ int read_extent_from_disk(struct extent_buffer *eb,
{
int ret;
ret = pread(eb->fd, eb->data + offset, len, eb->dev_bytenr);
- if (ret < 0)
+ if (ret < 0) {
+ ret = -errno;
goto out;
+ }
if (ret != len) {
ret = -EIO;
goto out;