Skip to content

Commit

Permalink
btrfs: fix EIO misuse to report missing degraded option
Browse files Browse the repository at this point in the history
EIO is only for the IO failure to the device, avoid it. Use ENOENT as
that's the closest error code describing what happened.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
[ update changelog ]
Signed-off-by: David Sterba <dsterba@suse.com>
  • Loading branch information
Anand Jain authored and David Sterba committed Oct 30, 2017
1 parent adfb69a commit 45dbdbc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/btrfs/volumes.c
Original file line number Diff line number Diff line change
Expand Up @@ -6437,7 +6437,7 @@ static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
!btrfs_test_opt(fs_info, DEGRADED)) {
free_extent_map(em);
btrfs_report_missing_device(fs_info, devid, uuid);
return -EIO;
return -ENOENT;
}
if (!map->stripes[i].dev) {
map->stripes[i].dev =
Expand Down Expand Up @@ -6570,7 +6570,7 @@ static int read_one_dev(struct btrfs_fs_info *fs_info,
if (!device) {
if (!btrfs_test_opt(fs_info, DEGRADED)) {
btrfs_report_missing_device(fs_info, devid, dev_uuid);
return -EIO;
return -ENOENT;
}

device = add_missing_dev(fs_devices, devid, dev_uuid);
Expand All @@ -6585,7 +6585,7 @@ static int read_one_dev(struct btrfs_fs_info *fs_info,
if (!device->bdev) {
btrfs_report_missing_device(fs_info, devid, dev_uuid);
if (!btrfs_test_opt(fs_info, DEGRADED))
return -EIO;
return -ENOENT;
}

if(!device->bdev && !device->missing) {
Expand Down

0 comments on commit 45dbdbc

Please sign in to comment.