UBIFS sync question
Artem Bityutskiy
dedekind at infradead.org
Wed Oct 1 01:40:03 EDT 2008
On Tue, 2008-09-30 at 15:28 -0700, Bruce_Leonard at selinc.com wrote:
> Artem,
>
> We've run into a side effect that we think is probably a design choice in
> UBIFS, but we want to make sure before we start trying to troubleshoot a
> "bug". What we do is open an existing file in a UBIFS formated UBI
> volume on a NAND flash, add a few lines to it, close the file, then
> WITHOUT un-mounting the file system, reboot the box (simulating a power
> outage). When the box reboots and we look at the file, it's zero length
> and has no contents. I suspect it's because UBIFS does less frequent
> syncs than say ext2 for performance reasons, and we're just losing the
> contents of the file because there's no sync before the reboot.
>
> Is this correct or do we need to start digging for something broken?
Well, you should sync the file, see
http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback
However, if you open a file, and just add few lines to it, then it
should not become empty after reboot. You should just loose whole or
part of new data.
I think you actually truncate the file, then re-write it, instead of
appending. This often happens in case of shell scripts - shell commands
like truncating files.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
More information about the linux-mtd
mailing list