UBIFS recovery truncates file to zero size

Iram Shahzad iram.shahzad at jp.fujitsu.com
Wed Mar 11 22:44:26 EDT 2009


Thanks Brijesh, Adrian, Reuben for your replies.

I understood, but please let me confirm further.

For the write back enabled case, I was expecting the
following behaviour:
    power went down before the file is sync-ed, so
    on the next booting the file will be in its old state,
    that is it will contain the contents which it had before
    this write.

But instead of being in the old state, it becomes empty file.
Is this really expected(correct) behaviour?

Thanks
Iram

----- Original Message ----- 
From: "Reuben Dowle" <Reuben.Dowle at navico.com>
To: "Iram Shahzad" <iram.shahzad at jp.fujitsu.com>; 
<linux-mtd at lists.infradead.org>
Sent: Thursday, March 12, 2009 3:13 AM
Subject: RE: UBIFS recovery truncates file to zero size


> The file is kept in the kernel write-back cache, until it is synced by
> the user (eg. A sync() or fsync() call) or the kernel decides to write
> it back (seems to be after 30 seconds by default).
>
> You can disable write back cache, but if you make lots of small writes
> to the file this will cause more wear on the flash. It is better to call
> fsync() when you want the data to be saved.
>
> See http://www.linux-mtd.infradead.org/doc/ubifs.html#L_writeback
>
> Also be carefull to note the comment about making your updates atomic.
> Just adding the odd fsync() is not going to truely guarenteed your data
> is not going to get fried.
>
> Reuben
>
> -----Original Message-----
> From: linux-mtd-bounces at lists.infradead.org
> [mailto:linux-mtd-bounces at lists.infradead.org] On Behalf Of Iram Shahzad
> Sent: Wednesday, 11 March 2009 10:16 p.m.
> To: linux-mtd at lists.infradead.org
> Subject: UBIFS recovery truncates file to zero size
>
> Hi
>
> I am having the following problem with UBIFS (Linux 2.6.25 +
> ubifs-v2.6.25).
> Please could you tell me if this is a known issue.
>
> Problem
>    If the power is switched off abruptly while a file is being written,
>    in the next boot the contents of the file is lost. That is, the file
>    becomes zero sized. The problem is reproducable.
>
> Thanks in advance.
> Iram
>
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 





More information about the linux-mtd mailing list