mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
btrfs: raid56: fix an incorrect csum skip during scrub
Commit7425a28940("btrfs: introduce btrfs_bio_for_each_block_all() helper") uses the new helper to replace the nested loop inside verify_bio_data_sectors(), which simplifies the code. However that also changed the behavior of "continue" when a block has no data checksum. Previously the "continue" would skip the old for() loop, which would also increase @total_sector_nr. Now the "continue" will skip the new btrfs_bio_for_each_block_all() loop, which doesn't update @total_sector_nr. This means if we hit a block that has no data checksum, we will skip all the remaining blocks no matter if they have data checksum. As @total_sector_nr will never be updated, and that test_bit() will always return false. Fix it by increasing @total_sector_nr before calling "continue". Fixes:7425a28940("btrfs: introduce btrfs_bio_for_each_block_all() helper") Reviewed-by: Daniel Vacek <neelx@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c438d34ec1
commit
330dcc553f
|
|
@ -1679,8 +1679,10 @@ static void verify_bio_data_sectors(struct btrfs_raid_bio *rbio,
|
|||
continue;
|
||||
|
||||
/* No csum for this sector, skip to the next sector. */
|
||||
if (!test_bit(total_sector_nr, rbio->csum_bitmap))
|
||||
if (!test_bit(total_sector_nr, rbio->csum_bitmap)) {
|
||||
total_sector_nr++;
|
||||
continue;
|
||||
}
|
||||
|
||||
expected_csum = rbio->csum_buf + total_sector_nr * fs_info->csum_size;
|
||||
btrfs_calculate_block_csum_pages(fs_info, paddrs, csum_buf);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user