Re: [BUG] btrfs: degraded RAID6 preallocated writes return EIO from fdatasync
From: Qu Wenruo
Date: Tue Sep 29 2026 - 06:53:25 EST
在 2026/9/29 20:04, Bartosz Fenski 写道:
Hello,
A fresh four-device Btrfs RAID6 filesystem returns EIO from fdatasync()
when writing to a file preallocated by fio after one device is removed.
The filesystem is clean before the device is removed, one missing device
is within RAID6 tolerance, and all surviving-device error counters remain
zero.
I reproduced this twice on unmodified upstream Linux v7.3-rc5. Both
runs failed after exactly the same number of writes and at the same
fdatasync offset. Disabling fio's preallocation makes the same workload
complete successfully.
I'll take a look.
[...]
A guard similar to the following before accessing csum_buf may be needed:
if (!test_bit(rbio_sector_index(rbio, stripe_nr, sector_nr),
rbio->csum_bitmap))
return 0;
It's already there, check verify_bio_data_sectors().
Anyway I'll try to reproduce and debug it here.
Thanks for the report,
Qu
The relevant checksum verification was introduced by commit:
7a3150723061 ("btrfs: raid56: do data csum verification during RMW cycle")
Current Btrfs for-next still appears to lack the per-sector bitmap check.
I searched the linux-btrfs archive and did not find an existing report
with this combination of a clean filesystem, one missing RAID6 member,
preallocated extents, and sync-time EIO.
I can test a proposed patch on the same v7.3-rc5 VM.
Regards,
Bartosz Fenski