summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/fs/gofer/gofer_test.go8
1 files changed, 7 insertions, 1 deletions
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)