On Sun, Jan 16, 2022 at 11:51:17PM -0800, Christoph Hellwig wrote: > So I actually noticed this during code inspection a while ago, but I > think we need to use the actual underlying device instead of NULL here > to keep our block layer gurantees. See the patch in my queue below. Makes sense. > --- > >From 1e330b8e57fc0d6c6fb07c0ec2915dca5d7a585a Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig <hch@xxxxxx> > Date: Thu, 13 Jan 2022 10:53:59 +0100 > Subject: block: assign bi_bdev for cloned bios in blk_rq_prep_clone > > The cloned bios for the cloned request in blk_rq_prep_clone currently > still point to the original bi_bdev. This is harmless because dm-mpath > doesn't look at bi_bdev but violates the invariants of always having > the correct bi_bdev. > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > --- > block/blk-mq.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/block/blk-mq.c b/block/blk-mq.c > index a6d4780580fcd..b5e35e63adad4 100644 > --- a/block/blk-mq.c > +++ b/block/blk-mq.c > @@ -2976,6 +2976,7 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src, > bio = bio_clone_fast(bio_src, gfp_mask, bs); > if (!bio) > goto free_and_out; > + bio->bi_bdev = rq->q->disk->part0; > > if (bio_ctr && bio_ctr(bio, bio_src, data)) > goto free_and_out; > -- > 2.30.2 Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx> -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel