On 2/13/19 3:37 PM, Johannes Thumshirn wrote:
> On 13/02/2019 15:32, Hans van Kranenburg wrote:
> [...]
>
>>> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
>>> index 03f223aa7194..b40cc7c830f4 100644
>>> --- a/fs/btrfs/volumes.c
>>> +++ b/fs/btrfs/volumes.c
>>> @@ -6794,7 +6794,7 @@ static int btrfs_check_chunk_valid(struct btrfs_fs_info *fs_info,
>>> (type & BTRFS_BLOCK_GROUP_RAID1 && num_stripes < 1) ||
>>> (type & BTRFS_BLOCK_GROUP_RAID5 && num_stripes < 2) ||
>>> (type & BTRFS_BLOCK_GROUP_RAID6 && num_stripes < 3) ||
>>> - (type & BTRFS_BLOCK_GROUP_DUP && num_stripes > 2) ||
>>> + (type & BTRFS_BLOCK_GROUP_DUP && num_stripes != 2) ||
>>> ((type & BTRFS_BLOCK_GROUP_PROFILE_MASK) == 0 &&
>>> num_stripes != 1)) {
>>> btrfs_err(fs_info,
>>>
>>
>> It looks like the RAID1 check has a similar problem. Shouldn't that
>> check also be != 2 ?
>
> Hmm I guess a degraded RAID1 can have only 1 stripe, doesn't it?
It's reading the metadata from disk here. So, there are always still
exactly two 'stripe' structs inside the chunk item data.
Hans