Skip to content

lfs_file_truncate cause file corruption #268

Open
@ajaybhargav

Description

@ajaybhargav

Hi @geky,

LFS has been acting strange. There is no error during read/write but file data itself is corrupt with lot of 0xFF in between correct data. I dumped the file (using lfs API, not raw SPI) on console, so you can see reading file is working fine. But the data inside is corrupted. See below:

The actual data... and then bunch of 0xFF
image

after 3220 bytes I get the correct data again:
image

The correct data starts with header, AIS/AHTT and ends with length of data written which is 0x70 in this case as highlighted above. We have only 4 files in the filesystem to store data logs. The current error case, size of files are are as follows. both normal_pri.bin and normal_sec.bin are corrupt.
0byte critical_pri.bin
232bytes critical_sec.bin
36804bytes normal_pri.bin
37180bytes normal_sec.bin
What I also observed is file also contains information or root record (metablock?) how can that be possible? it should not be part of file at all. see the file actually starts with this:

image

Any help would be appreciated.

Regards,
Ajay Bhargav

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions