JFFS2: truncated files after power loss scenario

Artem Bityutskiy dedekind1 at gmail.com
Sun Feb 6 10:25:25 EST 2011


On Sun, 2011-02-06 at 15:59 +0100, Sven wrote:
> Hi mtd list,
> 
> What is the expected behavior for files beeing written on a jffs2 (on
> nand) during a power loss? Would an incomplete file exist, or would the journaling do a roll back
> because of an incomplete transaction?
> Is there a difference with new files created, or existing files beeing modified?
> 
> My tests show that on next bootup the file exists, but is truncated. I have not seen any journaling related roll backs.
> 
> I took a look at this, because we have seen a truncated configuration file once. I'm not sure what caused this. Perhaps a power loss during write.

How big was this file?

> I wonder about the Inode #42 Version 5 to 9 and about why two Dirent exist(ed) for #ino 42.
> Do you think this was caused by a power loss scenario?

No, this is how JFFS2 works, this is related to the design. In short,
only v9 is valid, other versions are invalid, you can ignore them.

> The truncated file error happened on a 2.6.18 based kernel.
> I have done power loss tests on 2.6.34, which showed truncated files as well.

Please, give more information:

1. Your flash type, if NAND - page size.
2. What do you do to the file in your test - how exactly you change it.
3. How big is the file?

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list