On 03/07/2025 16:36, Mikulas Patocka wrote:
I suppose theoretically it could happen, and I'm happy to change.
However there seems to be precedent in assuming it won't:
- in stripe_op_hints(), we hold chunk_size in an unsigned int
- in raid0_set_limits(), we hold mddev->chunk_sectors << 9 in lim.io_min,
which is an unsigned int type.
Please let me know your thoughts on also changing these sort of instances. Is
it realistic to expect chunk_bytes > UINT_MAX?
Thanks,
John
dm-stripe can be created with a stripe size that is more than 0xffffffff
bytes.
Though, the integer overflow already exists in the existing dm-stripe
target:
static void stripe_io_hints(struct dm_target *ti,
struct queue_limits *limits)
{
struct stripe_c *sc = ti->private;
unsigned int chunk_size = sc->chunk_size << SECTOR_SHIFT;
limits->io_min = chunk_size;
limits->io_opt = chunk_size * sc->stripes;
}
What should we set there as io_min and io_opt if sc->chunk_size <<
SECTOR_SHIFT overflows?
Should we set nothing?
For io_min/opt, maybe reduce to a factor of the stripe size / width (and
which fits in a unsigned int).
I am not sure if it is even sane to have such huge values in io_min and
the bottom disk io_min should be used directly instead.
Martin Petersen might have a better idea.. he added those sysfs files :)
Thanks,
John