-
Notifications
You must be signed in to change notification settings - Fork 808
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
lfs_mount: LFS_ERR_INVAL raised because of unfound superblock #378
Comments
Ditto, same issue here. Littlefs has no issue with lfs_format and returns with a code of 0, all of it's various writes and read backs work fine in lfs_format. lfs_mount immediately after format fails due to failing to find the superblock. |
Alright, found the flaw on my end. I was writing blocks successfully but, block 1 was overwriting block 0 due to an address masking fault on my end. This would imply that lfs_format doesn't do any kind of "full sanity check" post formatting to ensure all blocks are in place before continuing to catch these kind of faults. It appears to only verify blocks right now immediately after writing. |
Hi, sorry about not being able to look into the original issue. It does sound like it might be something similar to what @marekr ran into. @marekr this is quite interesting. I thought we were doing a sanity check after formatting by re-fetching the superblock (after a format the only data on disk is the superblock): But after changing lfs_format to write both superblocks (#193), we now write the second block after the sanity check. It's surprising that the first fetch succeeds but that mount fails, my guess is that the uninitialized second block happens to have a lingering revision count that makes it look more recent than the superblock we just wrote. Moving the sanity-check fetch to the last operation in lfs_format should catch this. Thanks for pointing it out! |
Just as a note I had the same issue but moving the sanity check to after the force compaction function it cleared up the problem. |
Ah! I marked this as "needs fix" so I wouldn't forget about it, and then forgot about it. My bad. Pushed up the fix here: #508, thanks for the reminder. |
@geky - not a problem - I am the same way - too many distractions going on. Thanks for the update. |
I would like to use LittleFS to log some information into an internal flash memory (stm32l4). While running the boot count example, lfs_format and lfs_mount are done successfully:
But then when the MCU resets, I am unable to mount the file system (and so the boot_count file is re-created):
-22 is LFS_ERR_INVAL (invalid parameter). Using breakpoints, I have found out that the superblock was not found and that it failed here (lfs_mount(), l.3695):
The flash memory does not get erased in between. The configs seem good to me, but maybe I have missed something here. Moreover, I have tried to write and update boot count in a for loop after the first mount, and it worked fine (boot count gets updated), so I assume that writing and reading operations are not the issue here.
Did I miss something? Is there a bug?
Thanks,
Tristan
The text was updated successfully, but these errors were encountered: