From 41bfa87b6c27b3f0041906f99ae9d0d9531db898 Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Wed, 11 Feb 2015 11:30:45 -0500 Subject: [PATCH 1/2] manifest: Close archive once done using it manifest code calls TarLayer() and gets archive. This archive needs to be closed once caller is done using it to release the resrouces held by archive. For the devicemapper graphdriver, archive keeps a device mounted (device which is backing the layer). If archive.Close() is not called, that device remains mounted and later deletion of device fails leading to various other issues. Signed-off-by: Vivek Goyal --- graph/manifest.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graph/manifest.go b/graph/manifest.go index f9869fcaf2..4b9f9a631b 100644 --- a/graph/manifest.go +++ b/graph/manifest.go @@ -73,6 +73,8 @@ func (s *TagStore) newManifest(localName, remoteName, tag string) ([]byte, error return nil, err } + defer archive.Close() + tarSum, err := tarsum.NewTarSum(archive, true, tarsum.Version1) if err != nil { return nil, err From 064ff42d6d34b9c92e634f30ac1549d9786ab26f Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Wed, 11 Feb 2015 11:30:46 -0500 Subject: [PATCH 2/2] docker-call-close-archive-in-push-v2-image pushV2Image() calls TarLayer() which returns an archive. One needs to Close() the archive once done otherwise it will leave mounted devices if devicemapper graph driver is being used. Signed-off-by: Derek McGowan Signed-off-by: Vivek Goyal --- graph/push.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graph/push.go b/graph/push.go index 6ae2d670d6..290c1d0f5e 100644 --- a/graph/push.go +++ b/graph/push.go @@ -392,6 +392,8 @@ func (s *TagStore) pushV2Image(r *registry.Session, img *image.Image, endpoint * if err != nil { return err } + defer arch.Close() + tf, err := s.graph.newTempFile() if err != nil { return err