Skip to content

Commit

Permalink
overlay2: fix unmounting layer without merge dir
Browse files Browse the repository at this point in the history
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
  • Loading branch information
tonistiigi committed Feb 16, 2017
1 parent abe6a07 commit e1af6c8
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions daemon/graphdriver/overlay2/overlay.go
Expand Up @@ -30,7 +30,7 @@ import (
"github.com/docker/docker/pkg/mount"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/pkg/parsers/kernel"
"github.com/docker/go-units"
units "github.com/docker/go-units"

"github.com/opencontainers/runc/libcontainer/label"
)
Expand Down Expand Up @@ -553,7 +553,17 @@ func (d *Driver) Get(id string, mountLabel string) (s string, err error) {

// Put unmounts the mount path created for the give id.
func (d *Driver) Put(id string) error {
mountpoint := path.Join(d.dir(id), "merged")
dir := d.dir(id)
_, err := ioutil.ReadFile(path.Join(dir, lowerFile))
if err != nil {
// If no lower, no mount happened and just return directly
if os.IsNotExist(err) {
return nil
}
return err
}

mountpoint := path.Join(dir, "merged")
if count := d.ctr.Decrement(mountpoint); count > 0 {
return nil
}
Expand Down

0 comments on commit e1af6c8

Please sign in to comment.