Subject: Re: jffs2 robustness against powerfailure

From: David Jander <[email-masked]>
Date: Mon, 17 Oct 2005 08:42:05 +0200

On Friday 14 October 2005 16:33, Mark Chambers wrote:
>[...]
> Well, I can tell you this, from bitter experience:  Chips do strange stuff
> when power is
> coming or going.  One thing that can happen is addresses get messed up, so
> writes go
> to the wrong place.  You say your hardware is good, but it may not have
> been thoroughly characterized for power-down behavior.   Probably the same
> chip that
> generates a power-up reset generates a reset when power is falling, check
> if the trip
> voltage is high enough.

There's a hardware watchdog which monitors both power-supplies and asserts 
reset in case of failure. It's reliable and it works.
But that all doesn't matter. You seem to oversee three facts:
1.- The file being written to at the moment of power failure is always the 
file that has a CRC failure (if that happens) afterwards, not other files. So 
"writes go to the wrong place" is quite unlikely.
2.- If a piece of flash get's corrupted, there's always the jffs2's CRC that 
should trip and detect that block as invalid.
3.- If there really were writes to the wrong place, I'd expect that to be 
noticeable by looking at the files. There is random data being written to the 
files, but fortunately not that random: It's all 32-bit integers from 
0...10000. That makes the chances of corrupt random data, or valid data 
written to the wrong place not being noticed actually quite small!

It looks to me very much like a jffs2 bug or design flaw, maybe a 
race-condition, but since I don't know jffs2 internals that much, I can't 
tell for sure. Isn't this a known issue?

> You could rule a power problem out by running your tests where you reset
> the processor (shorting hreset or poreset somewhere) but not power-cycling
> the board, and see if
> the failures are the same.

I could do that, but I fear it will give the same results.
Ok, for sciences sake I'll do that experiment.

Sincerely,

-- 
David Jander