Skip to contentSkip to conversation

block: fix max segment size handling in blk_queue_virt_boundary

PATCH In review Christoph Hellwig 3 participants 4 messages Jul 24, 2019 – Jul 26, 2019 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 block/blk-settings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-settings.c +2 -1
index 2ae348c101a0..2c1831207a8f 100644
@@ -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);
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Christoph Hellwig

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")
---
 block/blk-settings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-settings.c +0 -0
index 2ae348c101a0..2c1831207a8f 100644

block/blk-settings.c void blk_queue_virt_boundary(struct request_queue *q, unsigned long mask) · line 759

Quoted 9 lines
block/blk-settings.c +2 -1
@@ -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);
 

Looks good to me!

#2 lore raw
In reply to Christoph Hellwig

Jens, can you take a look? This fixes a boot regression hitting various people.

Quoted 28 lines · Christoph Hellwig

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")
---
 block/blk-settings.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-settings.c +2 -1
index 2ae348c101a0..2c1831207a8f 100644
@@ -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);
 
Signature · 1 line
2.20.1

---end quoted text---

maintainer
#3 lore raw
Quoted 2 lines · Christoph Hellwig

Jens, can you take a look? This fixes a boot regression hitting various people.

Sorry, totally missed this... Did already send in a pull request today, but I'll get this applied and out before -rc2.

Signature · 1 line
Jens Axboe