From: Christoph Hellwig Date: Wed, 24 Jul 2019 16:26:56 +0000 (+0200) Subject: block: fix max segment size handling in blk_queue_virt_boundary X-Git-Tag: v5.4-rc1~450^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6c84f78e2f77be37b9a150ed33be992198741f0;p=platform%2Fkernel%2Flinux-rpi.git block: fix max segment size handling in blk_queue_virt_boundary We should only set the max segment size to unlimited if we actually have a virt boundary. Otherwise we accidentally clear that limit when called from the SCSI midlayer, which always calls blk_queue_virt_boundary, even if that mask is 0. Fixes: 7ad388d8e4c7 ("scsi: core: add a host / host template field for the virt boundary") Reported-by: Guenter Roeck Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/block/blk-settings.c b/block/blk-settings.c index 2ae348c..2c18312 100644 --- a/block/blk-settings.c +++ b/block/blk-settings.c @@ -752,7 +752,8 @@ void blk_queue_virt_boundary(struct request_queue *q, unsigned long mask) * page (which might not be idential to the Linux PAGE_SIZE). Because * of that they are not limited by our notion of "segment size". */ - q->limits.max_segment_size = UINT_MAX; + if (mask) + q->limits.max_segment_size = UINT_MAX; } EXPORT_SYMBOL(blk_queue_virt_boundary);