summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--runsc/boot/controller.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/runsc/boot/controller.go b/runsc/boot/controller.go
index ddba117c6..7d7803e92 100644
--- a/runsc/boot/controller.go
+++ b/runsc/boot/controller.go
@@ -315,6 +315,13 @@ func (cm *containerManager) Destroy(cid *string, _ *struct{}) error {
return fmt.Errorf("error removing directory %q: %v", containerRoot, err)
}
+ // Flushing dirent references triggers many async close operations. We
+ // must wait for those to complete before returning, otherwise the
+ // caller may kill the gofer before they complete, causing a cascade of
+ // failing RPCs.
+ log.Infof("Waiting for async filesystem operations to complete")
+ fs.AsyncBarrier()
+
// We made it!
log.Debugf("Destroyed container %q", *cid)
return nil