# kernel 4.0+ dmcrypt and disk corruption

## kernelOfTruth

Heads up !

Kernel 4.0+, dmcrypt == potential disk corruption ?

There currently seems to be an open issue of f2fs (?) and dmcrypt/cryptsetup, on SSD (only ?) that leads to filesystem corruption:

http://marc.info/?l=dm-devel&m=143051577322679&w=2

So make sure to create backups before upgrading

could be either issues in f2fs, dmcrypt or other parts of the kernel - or even specific SSD models

----------

## frostschutz

You're the one who reported this? (4.0 has been out for a while, somehow I'd expect more noise for such an issue.)

----------

## kernelOfTruth

Nope, 

just stumbled over it on the mailing list while looking for regressions

I might upgrade to 4.0 or 4.1 within the next days or few weeks so looking in advance if there's any trouble (currently rather happy with 3.19.y)

----------

## frostschutz

 *kernelOfTruth wrote:*   

> (currently rather happy with 3.19.y)

 

Same here, waiting with 4.x until at least 4.2 just in case something is checking for kernel version numbers and not able to handle 4.x yet.

----------

## elxa

I am running linux 4.0 on a dmcrypt encrypted ext4 rootfs (ssd, discards enabled) for more than 3 weeks and have never had any problem with it.

----------

## kernelOfTruth

 *elxa wrote:*   

> I am running linux 4.0 on a dmcrypt encrypted ext4 rootfs (ssd, discards enabled) for more than 3 weeks and have never had any problem with it.

 

then you're lucky   :Smile: 

what SSD are you using ?

meanwhile it's already two on the mailing list that report these issues

disabling NCQ (queue_depth to 1) might help

the second report includes the SSD - which appears to be a somewhat exotic model (LiteOn + mSATA)

LiteOn LGT-256M6G

There also seem to have been changes to NCQ handling with 4.0+ and/or 4.1

----------

## elxa

Samsung 830 256GB

----------

## frostschutz

As for NCQ, I have disabled it in either case (libata.force=noncq). I get better performance from my HDD RAID without it (maybe WD Greens are bad at NCQ handling?) and at the same time I couldn't find a single downside.

Also my SSD brand (Crucial) is known to have issues with delayed trim which is a subfeature of NCQ, so its better to be rid of it.

----------

## kernelOfTruth

 *frostschutz wrote:*   

> As for NCQ, I have disabled it in either case (libata.force=noncq). I get better performance from my HDD RAID without it (maybe WD Greens are bad at NCQ handling?) and at the same time I couldn't find a single downside.
> 
> Also my SSD brand (Crucial) is known to have issues with delayed trim which is a subfeature of NCQ, so its better to be rid of it.

 

Sounds like a good move to do in general:

http://marc.info/?l=linux-kernel&m=143195981313563&w=2

The Thread on the Mailing List got updated and it turned out it was an issue with NCQ and the SSD

----------

