From 85d67ac1450ff245af79ac907092fa55eb52fb32 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Wed, 15 Oct 2014 16:14:19 -0700 Subject: 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 Signed-off-by: David Sterba --- extent_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'extent_io.c') 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; -- cgit v1.2.3