[dm-devel] dm raid1, component device size check seem to fail at 32bit arch using u64 sector_t

joerg.diederich at mail.com joerg.diederich at mail.com
Thu Aug 16 17:00:33 UTC 2018

have looked a while for any changes and issues existing to this already, but did not found any. which is hopefully correct.
This is 
Linux gonzales 4.18.0-gentoo #3 SMP PREEMPT Wed Aug 15 15:33:45 CEST 2018 armv7l ARMv7 Processor rev 3 (v7l) SAMSUNG EXYNOS (Flattened Device Tree) GNU/Linux
PATCH V2 12/12 (2017-12-08 10:59:57 -050) introduced 
_check_data_dev_sectors in raid.c

Calculation in there uses 
to_sector(unsigned long n)

of a sector_t value, which is a u64 in case CONFIG_LBDAF is enabled. At a 32bit system, this results in a wrong value and the intended check fails, which is expected to be wrong. See example values at a used system (arm 32bit, 2TB raid1) below.

I might be wrong, if there is, may you please provide a hint to me how to proceed here? Currently, there's no perfect patch available here, as i admit ijust started investigating the source due to this behavior.

Thanks a lot & regards,

the said example, the outputs i'd added
[   49.004135] device-mapper: raid: _check_data_dev_sectors
[   49.004149] device-mapper: raid: sizeof(sector_t) 8
[   49.004161] device-mapper: raid: sizeof(unsigned long) 4
[   49.004206] device-mapper: raid: md.dev_sectors 1809793024, that is 926614028288 bytes
[   49.004242] device-mapper: raid: rdev->sectors 1809793024, that is 926614028288 bytes
[   49.004317] device-mapper: raid: i_size_read(rdev->bdev->bd_inode) returns 926614028288
[   49.004327] device-mapper: raid: i_size_read(rdev->bdev->bd_inode) >> 9 is 1809793024
[   49.004337] device-mapper: raid: to_sector(i_size_read(rdev->bdev->bd_inode)) returns 6242304
[   49.004346] device-mapper: raid: ds is 6242304
[   49.004356] device-mapper: raid: Error


More information about the dm-devel mailing list