diff options
author | Zach Brown <zab@zabbo.net> | 2014-10-15 16:14:19 -0700 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2014-11-03 18:35:30 +0100 |
commit | 85d67ac1450ff245af79ac907092fa55eb52fb32 (patch) | |
tree | 379c62fee5ee5d0d39fd0ee7ecbfb7b42b3eda0a /btrfs-map-logical.c | |
parent | 9662864435d23ecd4c9f91dd3ab5af2c062ed01f (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 'btrfs-map-logical.c')
-rw-r--r-- | btrfs-map-logical.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/btrfs-map-logical.c b/btrfs-map-logical.c index 6b475fc6..47d1104d 100644 --- a/btrfs-map-logical.c +++ b/btrfs-map-logical.c @@ -76,8 +76,18 @@ static struct extent_buffer * debug_read_block(struct btrfs_root *root, (unsigned long long)eb->dev_bytenr, device->name); kfree(multi); - if (!copy || mirror_num == copy) + if (!copy || mirror_num == copy) { ret = read_extent_from_disk(eb, 0, eb->len); + if (ret) { + fprintf(info_file, + "Error: failed to read extent: mirror %d logical %llu: %s\n", + mirror_num, (unsigned long long)eb->start, + strerror(-ret)); + free_extent_buffer(eb); + eb = NULL; + break; + } + } num_copies = btrfs_num_copies(&root->fs_info->mapping_tree, eb->start, eb->len); |