summaryrefslogtreecommitdiffhomepage
path: root/runsc/boot/controller.go
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2018-09-20 14:36:38 -0700
committerShentubot <shentubot@google.com>2018-09-20 14:37:53 -0700
commitcbaec4d61454f7426d14b44bf25c67282251453c (patch)
treeb202aaed023a9169794b1eca90ea18cea639d731 /runsc/boot/controller.go
parent9464b82a067df93101e77bd51800364671d7f032 (diff)
Wait for all async fs operations to complete before returning from Destroy.
Destroy flushes dirent references, which triggers many async close operations. We must wait for those to finish before returning from Destroy, otherwise we may kill the gofer, causing a cascade of failing RPCs and leading to an inconsistent FS state. PiperOrigin-RevId: 213884637 Change-Id: Id054b47fc0f97adc5e596d747c08d3b97a1d1f71
Diffstat (limited to 'runsc/boot/controller.go')
-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