diff --git a/layers.go b/layers.go index c2f1ca748..4261cd12d 100644 --- a/layers.go +++ b/layers.go @@ -479,7 +479,6 @@ func (r *layerStore) loadMounts() error { func (r *layerStore) Save() error { r.mountsLockfile.Lock() defer r.mountsLockfile.Unlock() - defer r.mountsLockfile.Touch() if err := r.saveLayers(); err != nil { return err } @@ -535,6 +534,9 @@ func (r *layerStore) saveMounts() error { if err = ioutils.AtomicWriteFile(mpath, jmdata, 0600); err != nil { return err } + if err := r.mountsLockfile.Touch(); err != nil { + return err + } return r.loadMounts() } @@ -953,7 +955,6 @@ func (r *layerStore) Mount(id string, options drivers.MountOpts) (string, error) return "", err } } - defer r.mountsLockfile.Touch() layer, ok := r.lookup(id) if !ok { return "", ErrLayerUnknown @@ -1004,7 +1005,6 @@ func (r *layerStore) Unmount(id string, force bool) (bool, error) { return false, err } } - defer r.mountsLockfile.Touch() layer, ok := r.lookup(id) if !ok { layerByMount, ok := r.bymount[filepath.Clean(id)]