[dm-devel] dm raid1, component device size check seem to fail at 32bit arch at >4byte values

Jörg Diederich joerg.diederich at mailbox.org
Fri Aug 17 07:27:32 UTC 2018


hello,
some hours i have looked for any changes and issues existing to this already, but did not found any. which is hopefully correct.

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 loff_t value returned by used i_size_read routine. Which is a long long type afaik. At a LP32 system, this results in a wrong value and intended check fails, which is expected to be wrong. At LP64, it should work of course. See example values at a used system (arm 32bit, 862GB 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, just started investigating the source due to this behavior.

Thanks a lot & regards,
Jörg


the said example,at system

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

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20180817/d4193f59/attachment.htm>


More information about the dm-devel mailing list