public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone
@ 2025-03-10 11:54 Ming Lei
  2025-03-10 13:30 ` Christoph Hellwig
  2025-03-10 13:50 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Ming Lei @ 2025-03-10 11:54 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: dm-devel, Ming Lei, stable, Christoph Hellwig

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(+)

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;
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-10 13:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 11:54 [PATCH V2] block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone Ming Lei
2025-03-10 13:30 ` Christoph Hellwig
2025-03-10 13:50 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox