Skip to content
Commit 7e7986f9 authored by Mike Snitzer's avatar Mike Snitzer Committed by Jens Axboe
Browse files

block: use gcd() to fix chunk_sectors limit stacking



commit 22ada802 ("block: use lcm_not_zero() when stacking
chunk_sectors") broke chunk_sectors limit stacking. chunk_sectors must
reflect the most limited of all devices in the IO stack.

Otherwise malformed IO may result. E.g.: prior to this fix,
->chunk_sectors = lcm_not_zero(8, 128) would result in
blk_max_size_offset() splitting IO at 128 sectors rather than the
required more restrictive 8 sectors.

And since commit 07d098e6 ("block: allow 'chunk_sectors' to be
non-power-of-2") care must be taken to properly stack chunk_sectors to
be compatible with the possibility that a non-power-of-2 chunk_sectors
may be stacked. This is why gcd() is used instead of reverting back
to using min_not_zero().

Fixes: 22ada802 ("block: use lcm_not_zero() when stacking chunk_sectors")
Fixes: 07d098e6 ("block: allow 'chunk_sectors' to be non-power-of-2")
Reported-by: default avatarJohn Dorminy <jdorminy@redhat.com>
Reported-by: default avatarBruce Johnston <bjohnsto@redhat.com>
Sign...
parent 47a84653
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment