From 5ad955ef07d2124d408809cd3882983db9b96392 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 10 Aug 2017 13:28:17 -0700 Subject: [PATCH] Unmount task directories when alloc is terminal This PR unmounts directories from tasks when the alloc is terminal rather than when it is garbage collected. /cc @angrycub --- client/alloc_runner.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/alloc_runner.go b/client/alloc_runner.go index 8b12c93c933c..3782f6039410 100644 --- a/client/alloc_runner.go +++ b/client/alloc_runner.go @@ -920,6 +920,12 @@ func (r *AllocRunner) handleDestroy() { r.allocID, err) } + // Unmount any mounted directories as no tasks are running and makes + // cleaning up Nomad's data directory simpler. + if err := r.allocDir.UnmountAll(); err != nil { + r.logger.Printf("[ERR] client: alloc %q unable unmount task directories: %v", r.allocID, err) + } + for { select { case <-r.ctx.Done():