summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-12-05 14:45:30 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-05 14:45:30 -0800
commitbe1515bad737ee9efe9229ab8313a236bfa03c5c (patch)
tree0bf2e9c6fab9a974cf6443084b92809fe1979322 /block
parent619ca2664cc6ebf6ecaff347d15ee8093b634e0c (diff)
parent7e7986f9d3ba69a7375a41080a1f8c8012cb0923 (diff)
Merge tag 'block-5.10-2020-12-05' of git://git.kernel.dk/linux-block
Pull block fix from Jens Axboe: "Single fix for an issue with chunk_sectors and stacked devices" * tag 'block-5.10-2020-12-05' of git://git.kernel.dk/linux-block: block: use gcd() to fix chunk_sectors limit stacking
Diffstat (limited to 'block')
-rw-r--r--block/blk-settings.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/block/blk-settings.c b/block/blk-settings.c
index 9741d1d83e98..659cdb8a07fe 100644
--- a/block/blk-settings.c
+++ b/block/blk-settings.c
@@ -547,7 +547,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
t->io_min = max(t->io_min, b->io_min);
t->io_opt = lcm_not_zero(t->io_opt, b->io_opt);
- t->chunk_sectors = lcm_not_zero(t->chunk_sectors, b->chunk_sectors);
+
+ /* Set non-power-of-2 compatible chunk_sectors boundary */
+ if (b->chunk_sectors)
+ t->chunk_sectors = gcd(t->chunk_sectors, b->chunk_sectors);
/* Physical block size a multiple of the logical block size? */
if (t->physical_block_size & (t->logical_block_size - 1)) {