From 6473b0f127c63e8a45b2b456d69e3de03273705c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 28 May 2015 08:26:49 +0200 Subject: [PATCH] remove redundant mount/unmount calls on commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit daemon.Diff already implements mounting for naivegraphdriver and aufs which does diffing on its owns does not need the container to be mounted. So new filesystem driver should mount filesystems on their own if it is needed to implement Diff(). This issue was reported by @kvasdopil while working on a freebsd port, because freebsd does not allow mount an already mounted filesystem. Also it saves some cycles for other operating systems as well. Signed-off-by: Jörg Thalheim --- daemon/commit.go | 5 ----- daemon/container_linux.go | 5 ----- 2 files changed, 10 deletions(-) diff --git a/daemon/commit.go b/daemon/commit.go index 28be6828b3..9848f64e8c 100644 --- a/daemon/commit.go +++ b/daemon/commit.go @@ -23,11 +23,6 @@ func (daemon *Daemon) Commit(container *Container, repository, tag, comment, aut defer container.Unpause() } - if err := container.Mount(); err != nil { - return nil, err - } - defer container.Unmount() - rwTar, err := container.ExportRw() if err != nil { return nil, err diff --git a/daemon/container_linux.go b/daemon/container_linux.go index 8dd839eb6f..38e8211315 100644 --- a/daemon/container_linux.go +++ b/daemon/container_linux.go @@ -828,20 +828,15 @@ func (container *Container) verifyDaemonSettings() { } func (container *Container) ExportRw() (archive.Archive, error) { - if err := container.Mount(); err != nil { - return nil, err - } if container.daemon == nil { return nil, fmt.Errorf("Can't load storage driver for unregistered container %s", container.ID) } archive, err := container.daemon.Diff(container) if err != nil { - container.Unmount() return nil, err } return ioutils.NewReadCloserWrapper(archive, func() error { err := archive.Close() - container.Unmount() return err }), nil