diff mbox series

[V2] block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone

Message ID 20250310115453.2271109-1-ming.lei@redhat.com (mailing list archive)
State New
Headers show
Series [V2] block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone | expand

Commit Message

Ming Lei March 10, 2025, 11:54 a.m. UTC
Make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone(),
otherwise requests cloned by device-mapper multipath will not have the
proper nr_integrity_segments values set, then BUG() is hit from
sg_alloc_table_chained().

Fixes: b0fd271d5fba ("block: add request clone interface (v2)")
Cc: stable@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
V2:
	- rewords commit log(Christoph)
	- add fixes tag(Christoph)

 block/blk-mq.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Christoph Hellwig March 10, 2025, 1:30 p.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Jens Axboe March 10, 2025, 1:50 p.m. UTC | #2
On Mon, 10 Mar 2025 19:54:53 +0800, Ming Lei wrote:
> Make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone(),
> otherwise requests cloned by device-mapper multipath will not have the
> proper nr_integrity_segments values set, then BUG() is hit from
> sg_alloc_table_chained().
> 
> 

Applied, thanks!

[1/1] block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone
      commit: fc0e982b8a3a169b1c654d9a1aa45bf292943ef2

Best regards,
diff mbox series

Patch

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 40490ac88045..005c520d3498 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3314,6 +3314,7 @@  int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
 		rq->special_vec = rq_src->special_vec;
 	}
 	rq->nr_phys_segments = rq_src->nr_phys_segments;
+	rq->nr_integrity_segments = rq_src->nr_integrity_segments;
 
 	if (rq->bio && blk_crypto_rq_bio_prep(rq, rq->bio, gfp_mask) < 0)
 		goto free_and_out;