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 13.02.19 г. 16:37 ч., 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 depends on the POV. 

root@ubuntu-virtual:~# fallocate -l 2g /media/scratch/disk1.img
root@ubuntu-virtual:~# fallocate -l 2g /media/scratch/disk2.img
root@ubuntu-virtual:~# losetup -f /media/scratch/disk1.img 
root@ubuntu-virtual:~# losetup -f /media/scratch/disk2.img 
root@ubuntu-virtual:~# mkfs.btrfs -draid1 /dev/loop0 /dev/loop1
root@ubuntu-virtual:~# losetup -d /dev/loop1
root@ubuntu-virtual:~# mount -odegraded /dev/loop0 /media/test/

 btrfs inspect-internal dump-tree -t chunk /dev/loop0  | grep -B1 -A5 DATA\|RAID1
	item 3 key (FIRST_CHUNK_TREE CHUNK_ITEM 30408704) itemoff 15863 itemsize 112
		length 214695936 owner 2 stripe_len 65536 type METADATA|RAID1
		io_align 65536 io_width 65536 sector_size 4096
		num_stripes 2 sub_stripes 0
			stripe 0 devid 2 offset 9437184
			dev_uuid adb924e5-830b-4eb0-b28a-f5bee6b709ca
			stripe 1 devid 1 offset 30408704
--
	item 4 key (FIRST_CHUNK_TREE CHUNK_ITEM 245104640) itemoff 15751 itemsize 112
		length 214695936 owner 2 stripe_len 65536 type DATA|RAID1
		io_align 65536 io_width 65536 sector_size 4096
		num_stripes 2 sub_stripes 0
			stripe 0 devid 2 offset 224133120
			dev_uuid adb924e5-830b-4eb0-b28a-f5bee6b709ca
			stripe 1 devid 1 offset 245104640



DMESG: 
[78623.920424] BTRFS warning (device loop0): devid 2 uuid adb924e5-830b-4eb0-b28a-f5bee6b709ca is missing

> 
> 



[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