chore(fs): only cache the cache for case FS, not the entire FS (#9701)

This would have addressed a recent issue that arose when re-ordering our
"filesystem layers". Specifically moving the caseFilesystem to the
outermost layer. The previous cache included the filesystem, and as such
all the layers below. This isn't desirable (to put it mildly), as you
can create different variants of filesystems with different layers for
the same path and options. Concretely this did happen with the mtime
layer, which isn't always present. A test for the mtime related breakage
was added in #9687, and I intend to redo the caseFilesystem reordering
after this.

Ref: #9677
Followup to: #9687
This commit is contained in:
Simon Frei
2024-09-12 20:35:21 +02:00
committed by GitHub
parent 0ea90dd932
commit ac8b3342ac
3 changed files with 43 additions and 41 deletions
+1 -1
View File
@@ -221,7 +221,7 @@ func TestRepro9677MissingMtimeFS(t *testing.T) {
// Now syncthing gets upgraded (or even just restarted), which resets the
// case FS registry as it lives in memory.
globalCaseFilesystemRegistry = caseFilesystemRegistry{fss: make(map[fskey]*caseFilesystem)}
globalCaseFilesystemRegistry = caseFilesystemRegistry{caseCaches: make(map[fskey]*caseCache)}
// This time we first create some filesystem without a database and thus no
// mtime-FS, which is used in various places outside of the folder code. We