FS#62693 - [linux] fstrim/discard destroying data on certain storage stacks

Attached to Project: Arch Linux
Opened by Michael Laß (Bevan) - Tuesday, 21 May 2019, 17:41 GMT
Last edited by Jan Alexander Steffens (heftig) - Wednesday, 22 May 2019, 01:05 GMT
Task Type Bug Report
Category Kernel
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Architecture All
Severity Critical
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 5
Private No



On Linux 5.1 there's a bug in the device-mapper which causes fstrim to discard either wrong or way too many blocks under certain circumstances. This leads to massive data loss.

Original report(s):
linux-btrfs@vger.kernel.org/msg87788.html"> https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg87788.html

Identified bad commit:

The issue hit at least one other person on the mailing list and one forum user:

For now, all people having this issues used LVM, dm-crypt and some Samsung SSD. The exact factors are not yet understood. However, reverting 61697a6abd24acba941359c6268a94f4afe4a53d seems to solve the issue. Maybe this commit should be reverted in the Arch linux package until the issue is resolved, or a prominent warning should be put out to the users to disable discards when using dm-crypt/LVM.
This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Wednesday, 22 May 2019, 01:05 GMT
Reason for closing:  Fixed
Additional comments about closing:  linux 5.1.3.arch2-1
Comment by Michael Laß (Bevan) - Tuesday, 21 May 2019, 20:06 GMT
Proposed patch: https://www.redhat.com/archives/dm-devel/2019-May/msg00102.html

We should however wait for feedback on this.