mount: absorb the WinFsp metadata cache window in the concurrent-reader test (#10636)

WriteFile's own existence probe runs while the file does not exist, and
WinFsp may serve that answer from its metadata cache for up to the
mount's FileInfoTimeout. A reader racing into that window failed its
open with not-found, which is the cache being a cache, not a defect in
concurrent reading. Establish visibility once before racing the readers,
so the test exercises what it is named for.
This commit is contained in:
Chris Lu
2026-08-07 19:45:30 -07:00
committed by GitHub
parent 0b78381513
commit 4527947afc
+15
View File
@@ -352,6 +352,21 @@ func TestConcurrentReaders(t *testing.T) {
t.Fatalf("write: %v", err)
}
// WriteFile's own existence probe ran while the file did not exist, and
// WinFsp may serve that answer from its metadata cache for up to the
// mount's FileInfoTimeout. Establish visibility once before racing the
// readers, so the race exercises concurrent reading rather than the
// cache window.
deadline := time.Now().Add(3 * time.Second)
for {
if _, err := os.Stat(path); err == nil {
break
} else if time.Now().After(deadline) {
t.Fatalf("file never became visible: %v", err)
}
time.Sleep(50 * time.Millisecond)
}
var wg sync.WaitGroup
errs := make(chan error, 8)
for r := 0; r < 8; r++ {