Hi,
I have a problem with some files/directories ending up in
lost+found after reboot. The scenario is that linux has booted and goes into an
automatic upgrade mode where files are read from a USB key. Some files are
copied from the USB key into the yaffs2 filesystem. Some tar and zipped
archives are copied to the yaffs2 fs and then unzipped and untarred. Some
existing files are removed; some of these files don’t actually exist.
There is an option to update the linux kernel and uboot. The kernel, uboot, and
fs are in different partitions on the nand flash. After the upgrade is finished
the system is shutdown and rebooted, the fs is checkpointed in the shutdown.
When trying to reboot, the system hangs because it cannot find some of the
files needed to boot. I can boot the system if I use a ramdisk. Mounting the
yaffs fs after booting from ramdisk shows the missing files/directories in the
lost+found directory. /bin was one of the missing directories. Looking at the
start scan debug messages and looking at the data in flash I found that the
objectId for the bin directory (261), which had a seq. number of 0x1004
was being used by a file with seq. number 0x2f09. Since the file was found
first in the backwards scan, the /bin directory was not found as it should be.
This problem only seems to occur on a small percentage of the boards that have
the upgrade run on them and is very difficult to get it to occur. A capture of
the generic messages from the upgrade (no yaffs debuggin was enabled) does not
show anything wrong.
I am on linux 2.6.30. Yaffs is from May 2009. The nand flash
is 4 GB with block size 524288, page size 4096, OOB size 128. The first approx.
34 MB is used for uboot and kernel. The upgrade size is ~21 MB, with around 500
files. The /bin directory is not written to in the upgrade.
I have loooked at some of the oob data for the various
objectId 261s but I am not familiar enough with yaffs to have found a cause.
Any help would be appreciated.
Thanks,
Mike