On 13/02/2019 15:32, Hans van Kranenburg wrote:
[...]
>> +++ 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 ?
So looking at the code again I think num_stripes == 1 for RAID1 will
result in the same division by 0 in calc_stripe_length().
I'll send a patch for RAID1 as well unless David speaks up and says he
wants it amended in this one.
Thanks,
Johannes
--
Johannes Thumshirn SUSE Labs Filesystems
jthumshirn@xxxxxxx +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850