Comment 1 for bug 2037064

Revision history for this message
Po-Hsu Lin (cypressyew) wrote :

The same failure can be found in Mantic 6.5.0-1005 as well:
ubuntu@autovm4:~/autotest-client-tests/ubuntu_btrfs_kernel_fixes/fixes$ sudo ./5fbc7c59fd22c5a6531b40b0759624b680a95e52.sh
fix 5fbc7c59fd22c5a6531b40b0759624b680a95e52

    Btrfs: fix unfinished readahead thread for raid5/6 degraded mounting

    Steps to reproduce:

     # mkfs.btrfs -f /dev/sd[b-f] -m raid5 -d raid5
     # mkfs.ext4 /dev/sdc --->corrupt one of btrfs device
     # mount /dev/sdb /mnt -o degraded
     # btrfs scrub start -BRd /mnt

    This is because readahead would skip missing device, this is not true
    for RAID5/6, because REQ_GET_READ_MIRRORS return 1 for RAID5/6 block
    mapping. If expected data locates in missing device, readahead thread
    would not call __readahead_hook() which makes event @rc->elems=0
    wait forever.

    Fix this problem by checking return value of btrfs_map_block(),we
    can only skip missing device safely if there are several mirrors.

mke2fs 1.47.0 (5-Feb-2023)
/dev/loop4 contains a btrfs file system
Discarding device blocks: done
Creating filesystem with 524288 4k blocks and 131072 inodes
Filesystem UUID: 2d62988f-a1b2-425d-9dd9-1695390d9317
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

mount: /dev/loop3: can't find in /etc/fstab.
mount /dev/loop3 on degraded raid5 failed
ubuntu@autovm4:~/autotest-client-tests/ubuntu_btrfs_kernel_fixes/fixes$ uname -a
Linux autovm4 6.5.0-5-generic #5-Ubuntu SMP PREEMPT_DYNAMIC Wed Sep 6 15:11:07 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux