Update to LFS v1.7.2 tag - to fix filesystem corruption due to file renames #831
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(from meshtastic/firmware#4395 )
Hi @hathach long time no see - I hope all is well for you! I'm back working on Meshtastic again and one of the things in my queue was addressing some problems we've seen in the field with LFS on nrf52. This PR is to address one of those problems - I'm submitting it upstream in hopes that it is useful for other adafruit users and also so we can stop using a temporary fork which contains this change.
Filesystem corruption due to LFS renames
While stress testing (rarely - a couple of times a day on a node repeatedly writing/renaming/rebooting/reading files) filesystem corruption was seen that was not caused due to a reboot while writing.
After some debugging and checking github history, it seems that someone else had already found and fixed this bug:
littlefs-project/littlefs@97d8d5e
As poor luck would have it they fixed it a few days after adafruit forked from the master LFS tree. The version in adafruit was forked on oct 15,2018 f328685. This version is version in framework-arduinoadafruitnrf52 is: commit cb62bf2188854c5b7c44383571ebb19a414e6137 (tag: v1.6.1)
With this fix the 'rename related' corruption no longer occurs.
Since it seemed I needed to update LFS, I went ahead and updated it to the 'final' LFS 1.x release (v1.7.2) so that hopefully this update will be more useful to other adafruit users.
The only other change in in v1.7.2 vs v1.6.1 is a check for 2GB files. which is not a real problem for adafruit obviously - but I included it anyways because tiny and then it will be easy for downstream users to know 'oh the version in adafruit is the final version of LFS 1.x.
I updated lfs.c and lfs.h by first generating a patch file between the old adafruit tree and v1.6.1 of LFS, then copied in the v1.7.2 version of those three files, then reapplied the patch file so that the (small number of) existing adafruit local changes were preserved.