[BUG] JFFS2 power loss recovery issues on NAND

Iwo Mergler iwo at call-direct.com.au
Mon Jun 16 21:03:22 EDT 2008

Alexey Korolev wrote:
> JFFS2 ignores read errors from NAND since it has own CRC. On attempt to
> read fragment from first 256 bytes JFFS2 detects CRC error as this
> region has been improperly corrected and considers
> node as invalid. Rest data on page is considered as good. 
> So if we write new file during power loss and we have several nodes in
> page, we may face bad case with hole in the middle of the file after
> power loss. It is a bug. 
> The attached picture may explain the issue better. 
> So for now it is clear how JFFS2 fails. It is not obvious how to fix it. 
> Do you have any suggestions or ideas how it could be fixed?
> Would it be a good idea do hack JFFS2 in order to read data one more
> time but without ECC correction in case of failed read?

I know of at least one hardware ECC implementation which can flag
errors within the ECC bytes separately. In other words, not all 
will detect/correct bit errors in the case of a ECC write error.

About how to fix it - what about making the reading without ECC the default
and only re-reading with ECC if JFFS2 finds an invalid checksum?

Kind regards,


More information about the linux-mtd mailing list