summaryrefslogtreecommitdiffstats
path: root/block/bounce.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-01-26 15:33:08 +0100
committerJens Axboe <axboe@kernel.dk>2021-01-26 16:50:01 +0100
commit46bbf653a67a36989a55dbb894c8b94c5ecb2858 (patch)
treeb6951d795c88d5e0a82c265db6005e2609b1feb7 /block/bounce.c
parentbcache: use bio_set_dev to assign ->bi_bdev (diff)
downloadlinux-46bbf653a67a36989a55dbb894c8b94c5ecb2858.tar.xz
linux-46bbf653a67a36989a55dbb894c8b94c5ecb2858.zip
block: inherit BIO_REMAPPED when cloning bios
Cloned bios are can be used to on the same device, in which case we need to inherit the BIO_REMAPPED flag to avoid a double partition remap. When the cloned bios are used on another device, bio_set_dev will clear the flag. Fixes: 309dca309fc3 ("block: store a block_device pointer in struct bio") Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bounce.c')
-rw-r--r--block/bounce.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block/bounce.c b/block/bounce.c
index a22a8a1942b2..fc55314aa426 100644
--- a/block/bounce.c
+++ b/block/bounce.c
@@ -247,6 +247,8 @@ static struct bio *bounce_clone_bio(struct bio *bio_src, gfp_t gfp_mask,
if (!bio)
return NULL;
bio->bi_bdev = bio_src->bi_bdev;
+ if (bio_flagged(bio_src, BIO_REMAPPED))
+ bio_set_flag(bio, BIO_REMAPPED);
bio->bi_opf = bio_src->bi_opf;
bio->bi_ioprio = bio_src->bi_ioprio;
bio->bi_write_hint = bio_src->bi_write_hint;