From 4527947afce232da4a088be0f2f480ce5ac99db5 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 7 Aug 2026 19:45:30 -0700 Subject: [PATCH] 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. --- test/winfsp/semantics_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/winfsp/semantics_test.go b/test/winfsp/semantics_test.go index 7620ca0ba..28175ee6c 100644 --- a/test/winfsp/semantics_test.go +++ b/test/winfsp/semantics_test.go @@ -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++ {