mirror of
https://gitee.com/openharmony/third_party_littlefs
synced 2024-11-23 06:50:37 +00:00
745d98cde0
This was caused by the new lfs_file_rawseek optimization that can skip flushing when calculated file->pos is unchanged combined with an implicit expectation in lfs_file_truncate that lfs_file_rawseek unconditionally sets file->pos. Because of this assumption, lfs_file_truncate could leave file->pos in an outdated state while changing the internal file metadata. Humorously, this was always gauranteed to trigger the skip in lfs_file_rawseek when we try to restore the file->pos, leaving the file->cache used to do the CTZ skip-list lookup in a potentially bad state. The easiest fix is to just update file->pos correctly. Note we don't want to explicitly flush since we can leverage the same noop optimization if we truncate to the file position. Which I've added a test for. |
||
---|---|---|
.. | ||
test_alloc.toml | ||
test_attrs.toml | ||
test_badblocks.toml | ||
test_dirs.toml | ||
test_entries.toml | ||
test_evil.toml | ||
test_exhaustion.toml | ||
test_files.toml | ||
test_interspersed.toml | ||
test_move.toml | ||
test_orphans.toml | ||
test_paths.toml | ||
test_relocations.toml | ||
test_seek.toml | ||
test_superblocks.toml | ||
test_truncate.toml |