fix: atomic saves for prefs, ACL, regions and companion blobs - #3254
fix: atomic saves for prefs, ACL, regions and companion blobs#3254benallfree wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Unfortunately this doesn't fix the issue on nRF boards using LittleFS due to differences between file system block size and page erase sizes. @oltaco and I spent significant time digging into the lower level stuff to resolve this, but ultimately it requires changes at the LittleFS level. You'll find that even with atomic writes, you'll still get file system corruption, or file loss during power off due to nRF erasing more blocks than LittleFS expects. Can be tested by saving preferences in app, and powering off the node while it's writing. Which would be a similar scenario as battery going flat while receiving/saving an advert payload to contacts database. |
|
Yep, @liamcottle is correct. The fix will be this #2964, I haven't had a single corruption with LFSv2. |
|
@liamcottle @oltaco Thank you for looking into this more. In #3012 I mentioned LFSv2 as a possible solution, it's great to learn that it is already underway. |
|
Just for clarity...this PR is not about FS corruption though. Currently there is a short window where prefs are deleted and new prefs have not been written. Is there any value to the write-rename vs delete-write? I still see a possibility where all prefs can get lost without filesystem corruption.f |
Hey guys I noticed that config writes currently truncate-then-write in place, which can risk losing prefs on a crash or failure. This PR makes those saves atomic write-rename instead.
Let me know what you think.