Fixed becksums picking up stale bd cache data

This is more a cludge than a real fix, we should probably be handled in
the bd-wrapper layer, but that's all a mess right now and slated for
future work.

The problem is that our "rewinding" of block-level progs for alignment
leaves our bd caches with stale data. This is normally fine, but then we
go read the stale data to calculate our becksum.

Dropping our caches before calculating the becksums fixes this, at least
temporarily.
This commit is contained in:
Christopher Haster
2023-12-18 00:42:05 -06:00
parent e82ebb8da2
commit 5339d49e33
+6
View File
@@ -10172,6 +10172,12 @@ static int lfsr_ftree_flush(lfs_t *lfs,
return err;
}
// TODO this is a cludge, but right now our bd layer is a mess,
// we need caches to be clean so becksum calculation does not pick
// up out-of-date pcaches/rcaches
lfs_cache_drop(lfs, &lfs->pcache);
lfs_cache_drop(lfs, &lfs->rcache);
// prepare our block pointer
LFS_ASSERT(bptr.cksize > 0);
LFS_ASSERT(bptr.cksize <= lfs->cfg->block_size);