Hello Jens

On Thu, Nov 9, 2017 at 1:51 AM, Jens Rudberg <jens@teenage.engineering> wrote:
Hi,
During development of a new embedded platform I have run into an unwanted behaviour by yaffs.
We use yaffs in direct mode on an micron SLC nand with 2k pages and built-in ECC functionality.
It seems like yaffs sometimes roll back the file system when it is mounted, even if there should be no checkpoint available.
We see this by noticing that sometimes after a sudden reboot / crash files are rollbacked to previous versions.

I was under the impression that the checkpoint is invalidated immediately when a partition is mounted, but this may not be the case?

No it should be invalidated as soon as there is any modification to the filesystem (modify file/directory, delete file/directory or any garbage collection). If you don't do any modifications the checkpoint will stay "forever".


Our current method to avoid this is to call yaffs_sync() after every file operation, which doesn’t seems like the right way to do it.
yaffs_sync() both does a full sync including checkpoint.
replacing the calls to yaffs_sync() with yaffs_sync_files()

What happens if you don't  use any checkpoint. eg. mount with skip_checkpt_read set to 1.

I will have a look at the log and see if anything stands out.

Regards

Charles