linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bio: ensure __bio_clone_fast copies bi_partno
@ 2017-11-17  7:47 Michael Lyle
  2017-11-17 11:04 ` Coly Li
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Michael Lyle @ 2017-11-17  7:47 UTC (permalink / raw)
  To: linux-block, linux-bcache
  Cc: Michael Lyle, Christoph Hellwig, Jens Axboe, stable

A new field was introduced in 74d46992e0d9dee7f1f376de0d56d31614c8a17a,
bi_partno, instead of using bdev->bd_contains and encoding the partition
information in the bi_bdev field.  __bio_clone_fast was changed to copy
the disk information, but not the partition information.  At minimum,
this regressed bcache and caused data corruption.

Signed-off-by: Michael Lyle <mlyle@lyle.org>
Fixes: 74d46992e0d9dee7f1f376de0d56d31614c8a17a
Reported-by: Pavel Goran <via-bcache@pvgoran.name>
Reported-by: Campbell Steven <casteven@gmail.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: <stable@vger.kernel.org>
---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/bio.c b/block/bio.c
index 101c2a9b5481..33fa6b4af312 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -597,6 +597,7 @@ void __bio_clone_fast(struct bio *bio, struct bio *bio_src)
 	 * so we don't set nor calculate new physical/hw segment counts here
 	 */
 	bio->bi_disk = bio_src->bi_disk;
+	bio->bi_partno = bio_src->bi_partno;
 	bio_set_flag(bio, BIO_CLONED);
 	bio->bi_opf = bio_src->bi_opf;
 	bio->bi_write_hint = bio_src->bi_write_hint;
-- 
2.14.1

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

end of thread, other threads:[~2017-11-17 20:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-17  7:47 [PATCH] bio: ensure __bio_clone_fast copies bi_partno Michael Lyle
2017-11-17 11:04 ` Coly Li
2017-11-17 11:34 ` Ming Lei
2017-11-17 15:08 ` Christoph Hellwig
2017-11-17 15:27 ` Jens Axboe
2017-11-17 16:50 ` Bart Van Assche
2017-11-17 17:02   ` Michael Lyle
2017-11-17 17:18   ` hch
2017-11-17 20:25 ` Campbell Steven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).