All of lore.kernel.org
 help / color / mirror / Atom feed
* JFFS2 losing files on mount
@ 2009-01-21  9:29 Marco Braga
  2009-01-21 15:05 ` Ricard Wanderlof
  0 siblings, 1 reply; 5+ messages in thread
From: Marco Braga @ 2009-01-21  9:29 UTC (permalink / raw)
  To: linux-mtd

Hi,

I am doing some power failure tests on an ARM7 based device using
JFFS2 on NAND flash and I am a bit disappointed by the early results.
At the moment I've done only some informal tests so I don't have a
detailed bug report or logs to provide. Information gathered on the
net gave me the impression that JFFS2 could withstand repeated power
failures without major damages. Losing last written data is not a
problem, but preserving filesystem consistency is.

The worst situation happened to me is a JFFS2 file system that keeps
loosing files after mount. This is what happened: After a lot of power
cycles, errors during mount are increasing (nothing really strange:
lost inodes, ECC errors, etc.), but infos on the internet say that
they must be considered "warnings". After last reboot, all the files
in the JFFS2 partition are lost on mount. Not a good situation...
I copy some more files in the fs, without any apparent problem. If I
read back them, they are ok. I sync the file system, check the files
again. Everything seems fine. Then I umount the partition, and mount
it back again. The same errors appear and the content of the file
system is lost again. All previous files are lost. This happened every
time I retried the same thing on that partition. At the end I had to
erase the partition and rebuild the JFFS2 file system again.

Disappearing file is not a good thing, but a filesystem that loses all
files every time it is mounted is even worse.

I'd like to hear your experiences. What do you think?

Regards,
Marco

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

* Re: JFFS2 losing files on mount
  2009-01-21  9:29 JFFS2 losing files on mount Marco Braga
@ 2009-01-21 15:05 ` Ricard Wanderlof
  2009-01-22  4:03   ` David Woodhouse
  0 siblings, 1 reply; 5+ messages in thread
From: Ricard Wanderlof @ 2009-01-21 15:05 UTC (permalink / raw)
  To: Marco Braga; +Cc: linux-mtd


On Wed, 21 Jan 2009, Marco Braga wrote:

> I am doing some power failure tests on an ARM7 based device using
> JFFS2 on NAND flash and I am a bit disappointed by the early results.
> ...
> I'd like to hear your experiences. What do you think?

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.

/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

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

* Re: JFFS2 losing files on mount
  2009-01-21 15:05 ` Ricard Wanderlof
@ 2009-01-22  4:03   ` David Woodhouse
  2009-01-22  6:33     ` Ricard Wanderlof
  0 siblings, 1 reply; 5+ messages in thread
From: David Woodhouse @ 2009-01-22  4:03 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Marco Braga, linux-mtd

On Wed, 2009-01-21 at 16:05 +0100, Ricard Wanderlof wrote:
> 
> On Wed, 21 Jan 2009, Marco Braga wrote:
> 
> > I am doing some power failure tests on an ARM7 based device using
> > JFFS2 on NAND flash and I am a bit disappointed by the early results.
> > ...
> > I'd like to hear your experiences. What do you think?
> 
> 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.

On NOR flash, we're a whole lot more tolerant of buggy userspace. Which
is what >99% of reports like Marco's turn out to be. Although we're
always interested in the possibility that it _does_ turn out to be a
real JFFS2 bug...

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

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

* Re: JFFS2 losing files on mount
  2009-01-22  4:03   ` David Woodhouse
@ 2009-01-22  6:33     ` Ricard Wanderlof
  2009-01-22  6:36       ` David Woodhouse
  0 siblings, 1 reply; 5+ messages in thread
From: Ricard Wanderlof @ 2009-01-22  6:33 UTC (permalink / raw)
  To: David Woodhouse; +Cc: Marco Braga, linux-mtd


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

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

* Re: JFFS2 losing files on mount
  2009-01-22  6:33     ` Ricard Wanderlof
@ 2009-01-22  6:36       ` David Woodhouse
  0 siblings, 0 replies; 5+ messages in thread
From: David Woodhouse @ 2009-01-22  6:36 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Marco Braga, linux-mtd

On Thu, 2009-01-22 at 07:33 +0100, Ricard Wanderlof wrote:
> 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?

Not unless the file was only just created, and you lose power before
that creation hits the medium.

> 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?

No, you're quite right.

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@intel.com                              Intel Corporation

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

end of thread, other threads:[~2009-01-22  6:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-21  9:29 JFFS2 losing files on mount Marco Braga
2009-01-21 15:05 ` Ricard Wanderlof
2009-01-22  4:03   ` David Woodhouse
2009-01-22  6:33     ` Ricard Wanderlof
2009-01-22  6:36       ` David Woodhouse

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.