Re: [PATCH] btrfs: ensure that a DUP block group has exactly two stripes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 14, 2019 at 05:21:54PM +0100, Johannes Thumshirn wrote:
> 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.

If the explanation and cause is the same, it's ok to put it into one
patch I think, but no strong preference here.



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux