UBIFS recovery truncates file to zero size
adrian.hunter at nokia.com
Thu Mar 12 06:25:27 EDT 2009
Iram Shahzad wrote:
>>> 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?
>> No. How were you updating the file?
> The file is updated by a Java application in the following way.
> FileOutputStream str = new FileOutputStream(aFilename);
> // some write here
> I switch off the power after confirming that the str.close() has been
> If I add str.getFD().sync(); after the str.flush(), the file looks good in
> the next boot. However my question still remains for the case
> when I do not call str.getFD().sync:
> "why the file becomes empty rather than being in its old state?".
> Linux MTD discussion mailing list
What makes you think that:
FileOutputStream str = new FileOutputStream(aFilename);
does not truncate the file to zero length?
More information about the linux-mtd