aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnand Jain2017-10-09 11:07:46 +0800
committerDavid Sterba2017-10-30 12:27:59 +0100
commit2b902dfc896ffab875842ed62820dca0b99ff461 (patch)
tree9509172649c45b93faa70fdd5a615befcd16d3b2
parent5a2b8e601c572527adfc4986941311c21effae6c (diff)
btrfs: fix use of error or warning for missing device
When device is missing without the -o degraded option then its an error so report it as an error instead of a warning. And when -o degraded option is provided, log the missing device as warning. Signed-off-by: Anand Jain <anand.jain@oracle.com> Reviewed-by: David Sterba <dsterba@suse.com> [ switch error to bool ] Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--fs/btrfs/volumes.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index ce5e9ec4cdde..4931b2df4043 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -6367,9 +6367,14 @@ static int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info,
}
static void btrfs_report_missing_device(struct btrfs_fs_info *fs_info,
- u64 devid, u8 *uuid)
+ u64 devid, u8 *uuid, bool error)
{
- btrfs_warn_rl(fs_info, "devid %llu uuid %pU is missing", devid, uuid);
+ if (error)
+ btrfs_err_rl(fs_info, "devid %llu uuid %pU is missing",
+ devid, uuid);
+ else
+ btrfs_warn_rl(fs_info, "devid %llu uuid %pU is missing",
+ devid, uuid);
}
static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
@@ -6442,7 +6447,7 @@ static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
if (!map->stripes[i].dev &&
!btrfs_test_opt(fs_info, DEGRADED)) {
free_extent_map(em);
- btrfs_report_missing_device(fs_info, devid, uuid);
+ btrfs_report_missing_device(fs_info, devid, uuid, true);
return -ENOENT;
}
if (!map->stripes[i].dev) {
@@ -6456,7 +6461,7 @@ static int read_one_chunk(struct btrfs_fs_info *fs_info, struct btrfs_key *key,
devid, PTR_ERR(map->stripes[i].dev));
return PTR_ERR(map->stripes[i].dev);
}
- btrfs_report_missing_device(fs_info, devid, uuid);
+ btrfs_report_missing_device(fs_info, devid, uuid, false);
}
map->stripes[i].dev->in_fs_metadata = 1;
}
@@ -6575,7 +6580,8 @@ static int read_one_dev(struct btrfs_fs_info *fs_info,
device = btrfs_find_device(fs_info, devid, dev_uuid, fs_uuid);
if (!device) {
if (!btrfs_test_opt(fs_info, DEGRADED)) {
- btrfs_report_missing_device(fs_info, devid, dev_uuid);
+ btrfs_report_missing_device(fs_info, devid,
+ dev_uuid, true);
return -ENOENT;
}
@@ -6586,12 +6592,16 @@ static int read_one_dev(struct btrfs_fs_info *fs_info,
devid, PTR_ERR(device));
return PTR_ERR(device);
}
- btrfs_report_missing_device(fs_info, devid, dev_uuid);
+ btrfs_report_missing_device(fs_info, devid, dev_uuid, false);
} else {
if (!device->bdev) {
- btrfs_report_missing_device(fs_info, devid, dev_uuid);
- if (!btrfs_test_opt(fs_info, DEGRADED))
+ if (!btrfs_test_opt(fs_info, DEGRADED)) {
+ btrfs_report_missing_device(fs_info,
+ devid, dev_uuid, true);
return -ENOENT;
+ }
+ btrfs_report_missing_device(fs_info, devid,
+ dev_uuid, false);
}
if(!device->bdev && !device->missing) {