From 8ba450363fed5aa44676c23b737404c52da26a5f Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Thu, 20 Dec 2018 17:22:15 -0800 Subject: Deflake gofer_test. We must wait for all lazy resources to be released before closing the rootFile. PiperOrigin-RevId: 226419499 Change-Id: I1d4d961a92b3816e02690cf3eaf0a88944d730cc --- pkg/sentry/fs/gofer/gofer_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/sentry/fs/gofer/gofer_test.go b/pkg/sentry/fs/gofer/gofer_test.go index b450778ca..36201f017 100644 --- a/pkg/sentry/fs/gofer/gofer_test.go +++ b/pkg/sentry/fs/gofer/gofer_test.go @@ -68,7 +68,13 @@ func rootTest(t *testing.T, name string, cp cachePolicy, fn func(context.Context // Ensure that the cache is fully invalidated, so that any // close actions actually take place before the full harness is // torn down. - defer m.FlushDirentRefs() + defer func() { + m.FlushDirentRefs() + + // Wait for all resources to be released, otherwise the + // operations may fail after we close the rootFile. + fs.AsyncBarrier() + }() // Execute the test. fn(ctx, h, root, rootInode) -- cgit v1.2.3