44

638206 – sys-kernel/gentoo-sources-4.14.0 - bcache destroys filesystem...

 6 years ago
source link: https://bugs.gentoo.org/show_bug.cgi?id=638206
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

638206 – sys-kernel/gentoo-sources-4.14.0

Gentoo's Bugzilla – Bug 638206

sys-kernel/gentoo-sources-4.14.0 - bcache destroys filesystems

Last modified: 2017-11-26 10:55:08 UTC node [gannet]

Bug 638206 - sys-kernel/gentoo-sources-4.14.0 - bcache destroys filesystems

Attachments
Add an attachment (proposed patch, testcase, etc.)
Note You need to log in before you can comment on or make changes to this bug.

Description

bug2017

2017-11-20 10:15:16 UTC

Using bcache can destroy the filesystem. Mine was gone after 3rd non sucesfull try to mount the rootfs. It was not possible to recover any file. (I had backups...)

Another report on the bcache mailing list:
https://www.spinics.net/lists/linux-bcache/msg05290.html

I would sugest to mask it with a warning that there is an bcache issue.

Comment 1

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-21 08:02:20 UTC

thanks for the report

Comment 2

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-21 08:29:57 UTC

masked the package and searching for more informations

Comment 3

xxoo

2017-11-21 09:46:31 UTC

maybe  no need to mask , 4.14.1 released !

Comment 4

Tomáš Mózes

2017-11-21 10:02:48 UTC

Sent to stable list an hour ago:

https://www.spinics.net/lists/stable/msg198707.html:
Hi---

Previously sent to stable was this patch, and it's made it into
Linus's tree for 4.16.  It's a rather urgent data corruption issue
that affects at minimum bcache but possibly other block subsystems.
Several users have lost data.  The issue was introduced in the 4.15
branch by 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer
and partitions index").

I'd really appreciate anything that can be done to get this into a
stable 4.15 release soon.

Thanks--

Mike

+ update (not yet indexed)

I don't know what I was thinking here, but I meant 4.14/4.15 and not
4.15/4.16.  :P

Mike

Comment 5

Tomáš Mózes

2017-11-21 10:28:30 UTC

Can you please try this patch? Probably a good candidate along with the 4.14.1 bump.

commit 62530ed8b1d07a45dec94d46e521c0c6c2d476e6
Author: Michael Lyle <[email protected]>
Date:   Thu Nov 16 23:47:25 2017 -0800

    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 <[email protected]>
    Fixes: 74d46992e0d9 ("block: replace bi_bdev with a gendisk pointer and partitions index")
    Reported-by: Pavel Goran <[email protected]>
    Reported-by: Campbell Steven <[email protected]>
    Reviewed-by: Coly Li <[email protected]>
    Reviewed-by: Ming Lei <[email protected]>
    Cc: <[email protected]> # 4.14
    Signed-off-by: Jens Axboe <[email protected]>

diff --git a/block/bio.c b/block/bio.c
index b94a802f8ba3..459cc857f3d9 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;

Comment 7

Mike Pagano

gentoo-dev

2017-11-21 11:28:20 UTC

(In reply to Tomáš Mózes from comment #6)
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/
> ?id=62530ed8b1d07a45dec94d46e521c0c6c2d476e6

Thanks for the info. I will add this patch and release with 4.14.1.

Comment 8

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-21 12:03:08 UTC

added in gentoo-sources-4.14.1

Comment 9

bug2017

2017-11-21 12:15:59 UTC

This bug affects sys-kernel/vanilla-sources-4.14.0 and sys-kernel/vanilla-sources-4.14.1 too.

Comment 10

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-21 12:29:07 UTC

you are right

Comment 11

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-21 12:40:07 UTC

masked as well

Comment 13

Mike Pagano

gentoo-dev

2017-11-21 12:52:46 UTC

Masked:

commit 3f3676066690d9a176a613f9779360b2030bb4a0
Author: Alice Ferrazzi <[email protected]>                                                                                                                                            
Date:   Tue Nov 21 12:33:45 2017 +0000                                                                                                                                                
                                                                                                                                                                                      
    profiles: mask sys-kernel/vanilla-sources-4.14.1.ebuild (bug 638206)                                                                                                              
                                                                                                                                                                                      
commit 1c37d6db7962c1a7db9c1ca63960ab2c8254894b
Author: Alice Ferrazzi <[email protected]>                                                                                                                                            
Date:   Tue Nov 21 17:26:28 2017 +0900                                                                                                                                                
                                                                                                                                                                                      
    profiles: mask sys-kernel/gentoo-sources-4.14.0 (bug 638206)


Released new version with patch included:

commit 0a8c30502306c781db8b2c973506e3c62da400e5 (HEAD -> master, origin/master, origin/HEAD)
Author: Mike Pagano <[email protected]>                                                                                                                                              
Date:   Tue Nov 21 07:47:51 2017 -0500                                                                                                                                                
                                                                                                                                                                                      
    sys-kernel/gentoo-sources: Linux patch 4.14.1 including a fix for bcache data corruption bug. See bug #638206.                                                                    

    Package-Manager: Portage-2.3.13, Repoman-2.3.3   


I think we're done, right?

Comment 14

Tomáš Mózes

2017-11-21 12:58:25 UTC

Thanks, it looks good indeed, should be fine :)

Comment 15

Tomáš Mózes

2017-11-21 12:59:38 UTC

(In reply to bug2017 from comment #0)
> Using bcache can destroy the filesystem. Mine was gone after 3rd non
> sucesfull try to mount the rootfs. It was not possible to recover any file.
> (I had backups...)
> 
> Another report on the bcache mailing list:
> https://www.spinics.net/lists/linux-bcache/msg05290.html
> 
> I would sugest to mask it with a warning that there is an bcache issue.

Can you please report back if it helped you? I don't use bcache and 4.14.0 works fine for me (except for one machine).

Comment 16

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-21 13:07:48 UTC

masked and removed affected kernel
sys-kernel/vanilla-sources-4.14.0
sys-kernel/vanilla-sources-4.14.1
sys-kernel/gentoo-sources-4.14.0

Comment 17

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-21 13:27:27 UTC

masked ck-sources-4.14.0
waiting mainteiner for removal

Comment 18

kuzetsa CatSwarm (kuza for short)

2017-11-21 14:04:24 UTC

Acknowledged. Thanks for the ping.

Comment 19

bug2017

2017-11-21 20:30:09 UTC

System is restored, about 170GB written, everything looks fine. (Btrfs scrub, reboot ...)

Comment 20

Alice Ferrazzi

Gentoo Infrastructuregentoo-dev

2017-11-22 01:15:51 UTC

@bug2017 thanks for the follow up

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK