-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File system corruption when creating directories #979
Comments
Hi @josesimoes, hmm, I have not seen something like this before. A couple questions to try to understand the context:
// set file attributes
// hardcoded to 128 which is value for FileAttributes_Normal
nanoAttributes = 128;
attr = (struct lfs_attr){
.type = NANO_LITTLEFS_ATTRIBUTE,
.size = NANO_LITTLEFS_ATTRIBUTE_SIZE,
.buffer = &nanoAttributes
}; This is a bit confusing. Maybe I am missing something, how exactly is nanoAttributes declared? Is it a uint8_t array of size 128? Just for completeness, what is the value of NANO_LITTLEFS_ATTRIBUTE and NANO_LITTLEFS_ATTRIBUTE_SIZE? NANO_LITTLEFS_ATTRIBUTE_SIZE should be the same size as the buffer array.
There is a special "force consistency" step that occurs on the first mutation after You can trigger this explicitly with It would be interesting to know if calling |
Just to close this issue, a quick follow-up: this ended being an issue in the driver. It was using the wrong command to erase the block. Great support from @geky! Definitely recommend it. 💯 👍🏻 |
This is kind of a follow-up on #973.
Take the following code, following a successful call to
lfs_format()
followed bylfs_mount()
.(please ignore the file system var which is coming from the rest of the test code)
All the above calls return successfully with
LFS_ERR_OK
.Now comes the unexpected situation.
Following the above, any of these calls fail with
LFS_ERR_CORRUPT
.Restarting the application (which detects the corruption on the 1st call to
lfs_mount()
which requires subsequent calls tolfs_format()
followed bylfs_mount()
and will execute the initial code again withLFS_ERR_OK
.Interestingly, if instead of calling
lfs_stat()
the following code is executed, everything runs smootly.I'm I missing something after the directory creation that can "force" any sync or similar? Or is the call to
lfs_stat()
somehow disrrupting the file system cache/integrity?The text was updated successfully, but these errors were encountered: