data corruption, power failure

Andrew Xiang andrewxiang at gmail.com
Tue Nov 4 13:52:02 EST 2008


I am using JFFS2 on 2.6.12 kernel. I have 2 big images in a same
subdirectory on the jffs2 NOR partitions. One image is squashfs
mounted, another one I am overwriting. During the process, a power
failure happen. After the system comes up, I see no error during the mount.
The file I am overwriting is not complete, that is okay, I delete that
anyway. But the one I am reading (squashfs mounted) is corrupted. Here
is error I get when I do a copy
[273629.868000] Data CRC 84b7bbfd != calculated CRC 63e69361 for node
at 02d399fc
cp: read error: Input/output error

Do you know what is reason?

How does JFFS2 handle power failure correctly? To guarantee that, you
need atomic write operation on the flash. Like when you do an GC erase
and put a special marker. You can do a incomplete erase and power
failure happen, leave it in a state not possible to determine if it is
valid or obsolete or clean.

And how come mount does not detect the error, I thought mount go
through and check every block.

-Andrew



More information about the linux-mtd mailing list