JFFS2 losing files on mount

Ricard Wanderlof ricard.wanderlof at axis.com
Thu Jan 22 01:33:20 EST 2009


On Thu, 22 Jan 2009, David Woodhouse wrote:

>> We use JFFS2 on both an ARM9-platform and on our own CRIS platform. We
>> never unmount the device in preparation for power down; when someone pulls
>> the plug, the system just dies. While we do occasionally see warning
>> messages about incomplete nodes during the next boot-up, we have never
>> experienced anything as severe as you mention, and we have not lost any
>> files on the JFFS2 filesystem either.
>
> Is this on NAND, or NOR flash? On NAND flash, you do actually have to
> have non-buggy userspace; if you don't use sync() or fsync()
> appropriately then there may be data which aren't yet flushed to the
> flash.

To be more specific, on NOR flash we never say any messages about bad data 
nodes. With NAND flashes we do. However, we have never experienced missing 
files the way Marco seems to have.

What's the situation though, assuming one doesn't use sync()/fsync(),
I can understand that data won't get flushed properly, but would that 
result in a file being lost?

In our case, the device may be powered down at any time. Let's assume an 
application has a lot of data to write, using several write() calls. I can 
envisage two scenarios:
1. Userspace app writes all data, but fails to call sync/fsync before
    power fails.
2. Userspace app writes some of its data, but power fails before it
    has time to write all.

In both cases I would imagine that the end result is the same - all data
is not written to the flash because the plug is pulled. Considering the 
data in the file, it doesn't matter if it wasn't written out by JFFS2 or 
becuase the application died to early. Or is this a faulty assumption?

/Ricard
--
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the linux-mtd mailing list