public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [BUG] JFFS2 power loss recovery issues on NAND
@ 2008-06-10 13:57 Alexey Korolev
  2008-06-17  1:03 ` Iwo Mergler
  0 siblings, 1 reply; 9+ messages in thread
From: Alexey Korolev @ 2008-06-10 13:57 UTC (permalink / raw)
  To: dwmw2; +Cc: joern, linux-mtd

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1621 bytes --]

David,

As I prommised we investigated the JFFS2 power loss issues and found
what exactly caused data corruption issues. The issue occurs not
only on the recent kernels (>2.6.25) but on old as well  - so I createed new thread.

The problem occurs when we face power loss during writing ECC bytes to
NAND. 
As we know one page of NAND device has 8 SW ECC regions. Assume 
we have written NAND main area correctly but got a power loss during
write of first 3 ECC bytes. For the first ECC region algorithm detects
that checksum is not the same but it detects one bit error (it is a
common situation for ECC algorithm to improperly detect 1bit error when
actual numer of error bits is large). Since ECC detects one bit error it
"corrects" one bit in NAND main area (in first 256 bytes). For other
regions ECC algorithm returned 2 bit errors and did not perform any
correction. 
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?


Thanks,
Alexey

[-- Attachment #2: explanation of power loss issue --]
[-- Type: IMAGE/gif, Size: 54535 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-06-18 12:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-10 13:57 [BUG] JFFS2 power loss recovery issues on NAND Alexey Korolev
2008-06-17  1:03 ` Iwo Mergler
2008-06-17  8:13   ` Matthieu CASTET
2008-06-17  9:24     ` Jörn Engel
2008-06-17 16:00       ` Alexey Korolev
2008-06-17 16:57         ` Jörn Engel
2008-06-17 23:51     ` Iwo Mergler
2008-06-18 12:19       ` Jamie Lokier
2008-06-18 12:33         ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox