commit:     e643729a50271d73aebedf7166075449cb64403a
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 21 11:34:02 2017 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Tue Nov 21 11:34:02 2017 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=e643729a

Add fix for bcache data corruption bug. See bug #638206.

 0000_README                                        |  4 +++
 ..._bcache-data-corruption-fix-for-bi-partno.patch | 38 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/0000_README b/0000_README
index a8d45fc..5bfe726 100644
--- a/0000_README
+++ b/0000_README
@@ -55,6 +55,10 @@ Patch:  
1510_fs-enable-link-security-restrictions-by-default.patch
 From:   
http://sources.debian.net/src/linux/3.16.7-ckt4-3/debian/patches/debian/fs-enable-link-security-restrictions-by-default.patch/
 Desc:   Enable link security restrictions by default.
 
+Patch:         2100_bcache-data-corruption-fix-for-bi-partno.patch
+From:   
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=62530ed8b1d07a45dec94d46e521c0c6c2d476e6
+Desc:   bio: ensure __bio_clone_fast copies bi_partno. 
+
 Patch:  2300_enable-poweroff-on-Mac-Pro-11.patch
 From:   
http://kernel.ubuntu.com/git/ubuntu/ubuntu-xenial.git/patch/drivers/pci/quirks.c?id=5080ff61a438f3dd80b88b423e1a20791d8a774c
 Desc:   Workaround to enable poweroff on Mac Pro 11. See bug #601964.

diff --git a/2100_bcache-data-corruption-fix-for-bi-partno.patch 
b/2100_bcache-data-corruption-fix-for-bi-partno.patch
new file mode 100644
index 0000000..dd4aed6
--- /dev/null
+++ b/2100_bcache-data-corruption-fix-for-bi-partno.patch
@@ -0,0 +1,38 @@
+From 62530ed8b1d07a45dec94d46e521c0c6c2d476e6 Mon Sep 17 00:00:00 2001
+From: Michael Lyle <ml...@lyle.org>
+Date: Thu, 16 Nov 2017 23:47:25 -0800
+Subject: bio: ensure __bio_clone_fast copies bi_partno
+
+A new field was introduced in 74d46992e0d9, 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 <ml...@lyle.org>
+Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and 
partitions index")
+Reported-by: Pavel Goran <via-bca...@pvgoran.name>
+Reported-by: Campbell Steven <caste...@gmail.com>
+Reviewed-by: Coly Li <col...@suse.de>
+Reviewed-by: Ming Lei <ming....@redhat.com>
+Cc: <sta...@vger.kernel.org> # 4.14
+Signed-off-by: Jens Axboe <ax...@kernel.dk>
+---
+ block/bio.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/block/bio.c b/block/bio.c
+index b94a802..459cc85 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;
+-- 
+cgit v1.1
+

Reply via email to