Skip to content
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

fix #4184: loss of config files due to filesystem full on nrf52 #4397

Merged
merged 4 commits into from
Aug 6, 2024

Conversation

geeksville
Copy link
Member

@geeksville geeksville commented Aug 5, 2024

fix #4184

Hi ya'll,

I think this PR is ready now with the fixes described in 4184. If you think it is good to merge I think it is an important fix. That said: I would hold off on telling everyone "go test and see if your flash problems are gone". Because #4395 is still pretty easy for me to reproduce if I power cycle/reset a board while it is writing config files. I'm working on that one now.

Tested on tbeam (esp32) and rak4631 (nrf52)

@geeksville geeksville force-pushed the pr-fix4184 branch 3 times, most recently from 8e7c0e8 to fef5f96 Compare August 6, 2024 00:24
* Use SafeFile for atomic file writing (with xor checksum readback)
* Write db.proto last because it could be the largest file on the FS (and less critical)
* Don't keep a tmp file around while writing db.proto (because too big to fit two files in the filesystem)
* generate a new critial fault if we encounter errors writing to flash
either CriticalErrorCode_FLASH_CORRUPTION_RECOVERABLE or CriticalErrorCode_FLASH_CORRUPTION_UNRECOVERABLE
(depending on if the second write attempt worked)
* reformat the filesystem if we detect it is corrupted (then rewrite our config files) (only on nrf52 - not sure
yet if we should bother on ESP32)
* If we have to format the FS, make sure to preserve the oem.proto if it exists
@geeksville geeksville changed the title bug #4184 WIP do not merge fix #4184: loss of config files due to filesystem full on nrf52 Aug 6, 2024
@geeksville geeksville requested a review from thebentern August 6, 2024 16:59
@geeksville geeksville marked this pull request as ready for review August 6, 2024 16:59
@thebentern thebentern requested a review from caveman99 August 6, 2024 17:27
@thebentern thebentern merged commit 66c41e6 into meshtastic:master Aug 6, 2024
99 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: config file corruption due to filesystem size
2 participants