Kernel 4.0 removed an artificial IO limit, this caused a regression when using dm-crypt containers on some SSDs with NCQ (Samsung SSD 850 for example). DM crypt's new IO exceeds some SSD's max_segments limits. When this happens, the fs will be put in read only mode by the kernel and dmesg will be spammed over with ata errors. Data corruption is possible, I lost some data due to that problem. Upstream provided a patch which can be applied against all kernels starting with 4.0. The patch fixes the issue and is already in kernel 4.3-rc3. See upstream bug for the patch: https://bugzilla.kernel.org/show_bug.cgi?id=104421 I claim to add that patch to the gentoo patchset for kernel series 4.0, 4.1 and 4.2. This is a serious issue as data corruption will be likely if affected. I have been testing it on sys-kernel/vanilla-sources-4.1.* since 2015-09-11, I didn't encounter problems. Reproducible: Always Steps to Reproduce: 1.Use NCQ 2.Encrypt a Samsung SSD with dm crypt and create a filesystem in the container 3.mount the container and its filesystem 4.copy a big file to that filesystem and watch dmesg 5.after 20 to 30 seconds you will see write errors Actual Results: IO errors force the target fs in ro mode, fs becomes corrupted, data loss possible Expected Results: No IO errors should occure
Created attachment 412972 [details, diff] dm crypt: constrain crypt device's max_segment_size to PAGE_SIZE
Thanks for reporting. I'll start adding this one into those kernel versions.
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=586b286b110e94eb31840ac5afc0c24e0881fe34
All queued up for next releases
In 4.1.9 and 4.2.2. 4.0.X is EOL