Skip to content

Commit be1515b

Browse files
committed
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
2 parents 619ca26 + 7e7986f commit be1515b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

block/blk-settings.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,10 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
547547

548548
t->io_min = max(t->io_min, b->io_min);
549549
t->io_opt = lcm_not_zero(t->io_opt, b->io_opt);
550-
t->chunk_sectors = lcm_not_zero(t->chunk_sectors, b->chunk_sectors);
550+
551+
/* Set non-power-of-2 compatible chunk_sectors boundary */
552+
if (b->chunk_sectors)
553+
t->chunk_sectors = gcd(t->chunk_sectors, b->chunk_sectors);
551554

552555
/* Physical block size a multiple of the logical block size? */
553556
if (t->physical_block_size & (t->logical_block_size - 1)) {

0 commit comments

Comments
 (0)