# ext4, linux-4.0.4 and data corruption

## bammbamm808

My reading seems to strongly imply that the corruption issues with >linux.4.0.1 are limited to RAID0 setups, but there are a few claiming that they have experienced this issue without a RAID setup.

What say you? Has it been fixed in 4.0.4? Want to play with the new kernel, but I just migrated my Gen2 to this hardware, and don't want to lose any data.

----------

## Jack Hair

I've been running 4.0.4 since the day it was released and haven't had problems with my ext4 partitions so far. From what I understand only (single) SSD's and RAID0 arrays are affected. But on a single HDD it's ok.

----------

## bammbamm808

Hmmm .....single SSD here. I will let others test the waters further. Thanks.

----------

## kernelOfTruth

just disable NCQ to be safer:

append the following to grub or other bootloader:

```
libata.force=noncq
```

There was also a data-corruption issue related to faulty NCQ implementation with SSDs and kernel 4.0.y

edit:

not sure if yours is related or the same

----------

## EmaRsk

From the the Arch forum thread (https://bbs.archlinux.org/viewtopic.php?id=197400&p=2):  *matthew02 wrote:*   

> Disabling NCQ obviously didn't help.

 

----------

## EmaRsk

There is a fix already, waiting to be pushed:

http://git.neil.brown.name/?p=md.git;a=commitdiff;h=a81157768a00e8cf8a7b43b5ea5cac931262374f

----------

## kernelOfTruth

 *EmaRsk wrote:*   

> From the the Arch forum thread (https://bbs.archlinux.org/viewtopic.php?id=197400&p=2):  *matthew02 wrote:*   Disabling NCQ obviously didn't help. 

 

There's yet another issue:

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

<-- this is the one I'm referring to

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

 *Quote:*   

> > I've been running with NCQ disabled and been stress testing for awhile and the
> 
> > issue is indeed gone. Thanks for the workaround!
> 
> > 
> ...

 

----------

## EmaRsk

OK, so it's a different bug altogether. Is the one mentioned by the OP? He was talking about RAID, not dm-crypt.

----------

## kernelOfTruth

Well, he didn't mention it - but he also didn't exclude it

so posting it here in case it applies

----------

## jfranz2

The problem is very specific as it seems to only affect people who are running SSD's in raid 0 while using TRIM/discard options. If you aren't doing the aforementioned you should be fine.

----------

## EmaRsk

 *kernelOfTruth wrote:*   

> posting it here in case it applies

 

 *kernelOfTruth wrote:*   

> just disable NCQ and you should be mostly save

 

Still, this is false. Disabling NCQ does not fix the bug the OP was probably referring to: if the kernel is not patched, a fstrim operation can cause data loss.

If NCQ is relevant to another bug, thank you for reporting, it's good to know, but please be aware (and make us aware) that it's a separate issue, otherwise one would gain a false sense of security by fixing it, still being exposed to the other bug.

EDIT: Reading my post again, I realized that it could be read in a confronting or rude tone. It wasn't meant to be that, sorry.

I'm just not really good to convey a friendly vibe while writing, and English not being my mother language doesn't help, I suppose.

I'll add some smilies to make up:    :Smile:   :Smile:   :Smile: 

----------

## kernelOfTruth

 *EmaRsk wrote:*   

>  *kernelOfTruth wrote:*   posting it here in case it applies 
> 
>  *kernelOfTruth wrote:*   just disable NCQ and you should be mostly save 
> 
> Still, this is false. Disabling NCQ does not fix the bug the OP was probably referring to: if the kernel is not patched, a fstrim operation can cause data loss.
> ...

 

Haha - yeah,

it ended up like  that here   :Embarassed: 

My bad, the fault's however also on my side,

I corrected the wording in the post so that people affected don't get into a false sense of safety when they aren't

Thanks for the push in the right direction   :Wink: 

----------

