I found out a few things in the meantime:
* My IO scheduler is mq-deadline by default. When I switch it to none,
the problem disappears
* What hangs is the call to wait_on_buffer inside wait_dev_supers, while
waiting for superblock 0 of device 1 to be written. That is /dev/sda8,
i.e. the one which is physically behind /dev/sda2, but has the lower
device id
So it seems to me as if btrfs produces some strange sequence of writes
which confuse the scheduler and cause it to hang? Could this have to do
with the fact that the order of devids is different to the physical
order of the partitons?
If you guys want me to, I can definitely put some printks etc. into my
kernel. I just know too little about the code to see what information
could be useful.
> What do you get for:
> mount | grep btrfs
> btrfs insp dump-s -f /dev/sda8
$ mount | grep btrfs
/dev/sda8 on / type btrfs (rw,relatime,ssd,space_cache,subvolid=5,subvol=/)
$ btrfs insp dump-s -f /dev/sda8
superblock: bytenr=65536, device=/dev/sda8
---------------------------------------------------------
csum_type 0 (crc32c)
csum_size 4
csum 0x5a2fbdf1 [match]
bytenr 65536
flags 0x1
( WRITTEN )
magic _BHRfS_M [match]
fsid c4c0b512-00d3-42f2-a2e1-dcc62a2acd98
label
generation 575201
root 622264320
sys_array_size 97
chunk_root_generation 574575
root_level 1
chunk_root 241407393792
chunk_root_level 1
log_root 0
log_root_transid 0
log_root_level 0
total_bytes 243285360640
bytes_used 184232562688
sectorsize 4096
nodesize 16384
leafsize (deprecated) 16384
stripesize 4096
root_dir 6
num_devices 2
compat_flags 0x0
compat_ro_flags 0x0
incompat_flags 0x161
( MIXED_BACKREF |
BIG_METADATA |
EXTENDED_IREF |
SKINNY_METADATA )
cache_generation 575201
uuid_tree_generation 574411
dev_item.uuid 3e8d6ecb-a595-4c6a-aae8-e6a09e5b151d
dev_item.fsid c4c0b512-00d3-42f2-a2e1-dcc62a2acd98 [match]
dev_item.type 0
dev_item.total_bytes 187823030272
dev_item.bytes_used 183523868672
dev_item.io_align 4096
dev_item.io_width 4096
dev_item.sector_size 4096
dev_item.devid 1
dev_item.dev_group 0
dev_item.seek_speed 0
dev_item.bandwidth 0
dev_item.generation 0
sys_chunk_array[2048]:
item 0 key (FIRST_CHUNK_TREE CHUNK_ITEM 241407361024)
length 33554432 owner 2 stripe_len 65536 type SYSTEM
io_align 65536 io_width 65536 sector_size 4096
num_stripes 1 sub_stripes 1
stripe 0 devid 2 offset 1074790400
dev_uuid d56afd3b-d89c-4e59-8850-7dedd84900b9
backup_roots[4]:
backup 0:
backup_tree_root: 618283008 gen: 575198 level: 1
backup_chunk_root: 241407393792 gen: 574575 level: 1
backup_extent_root: 616038400 gen: 575198 level: 2
backup_fs_root: 593952768 gen: 575198 level: 2
backup_dev_root: 487751680 gen: 575188 level: 0
backup_csum_root: 594149376 gen: 575198 level: 2
backup_total_bytes: 243285360640
backup_bytes_used: 184231972864
backup_num_devices: 2
backup 1:
backup_tree_root: 613908480 gen: 575199 level: 1
backup_chunk_root: 241407393792 gen: 574575 level: 1
backup_extent_root: 607731712 gen: 575199 level: 2
backup_fs_root: 622444544 gen: 575200 level: 2
backup_dev_root: 487751680 gen: 575188 level: 0
backup_csum_root: 603389952 gen: 575199 level: 2
backup_total_bytes: 243285360640
backup_bytes_used: 184232038400
backup_num_devices: 2
backup 2:
backup_tree_root: 628539392 gen: 575200 level: 1
backup_chunk_root: 241407393792 gen: 574575 level: 1
backup_extent_root: 616103936 gen: 575200 level: 2
backup_fs_root: 622444544 gen: 575200 level: 2
backup_dev_root: 487751680 gen: 575188 level: 0
backup_csum_root: 616890368 gen: 575200 level: 2
backup_total_bytes: 243285360640
backup_bytes_used: 184232468480
backup_num_devices: 2
backup 3:
backup_tree_root: 622264320 gen: 575201 level: 1
backup_chunk_root: 241407393792 gen: 574575 level: 1
backup_extent_root: 617791488 gen: 575201 level: 2
backup_fs_root: 615432192 gen: 575201 level: 2
backup_dev_root: 487751680 gen: 575188 level: 0
backup_csum_root: 615841792 gen: 575201 level: 2
backup_total_bytes: 243285360640
backup_bytes_used: 184232562688
backup_num_devices: 2