Comment 66 for bug 1259829

juanmanuel (rockerito99) wrote :

OMG!
Has anyone besides the OP reproduced the issue on these drives?

I'm not even sure that his FS corruption, in this particular instance, is because of the hardware layer:

       The Original Poster (Ritesh), states in post #31 (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1259829/comments/31) that he is using an encryption layer below EXT4 for the root partition.

It is totally NOT recommended to use TRIM or DISCARD together with a software encryption level solution, and it might be causing the problems that the OP encountered. The ext4 errors problems are easy to explain (fs corruption due to messing with "empty space" on which the encryption solution relied). The read error problems, could also be easily explained: a corrupted filesystem which has corrupted pointers to invalid regions of the disk, will provoke ata read errors.

All this is because the encryption layer might store internal info on more blocks than the EXT4 fs reports. Fstrim/discard only looks at used blocks from the EXT4 filesystem's perspective. The result is that one could end up trimming a block used by LUKS (dm-crypt), and corrupt a little or a lot of data, depending on luck. (unless luks/dm-crypt guarantees that all used blocks are also mapped by EXT4).

Cheers,
Juan Manuel Cabo