|
@@ -515,7 +515,7 @@ func (d *Driver) Remove(id string) error {
|
|
|
}
|
|
|
|
|
|
// Get creates and mounts the required file system for the given id and returns the mount path.
|
|
|
-func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
|
|
+func (d *Driver) Get(id, mountLabel string) (_ containerfs.ContainerFS, retErr error) {
|
|
|
d.locker.Lock(id)
|
|
|
defer d.locker.Unlock(id)
|
|
|
dir := d.dir(id)
|
|
@@ -538,9 +538,11 @@ func (d *Driver) Get(id, mountLabel string) (containerfs.ContainerFS, error) {
|
|
|
return containerfs.NewLocalContainerFS(mergedDir), nil
|
|
|
}
|
|
|
defer func() {
|
|
|
- if err != nil {
|
|
|
+ if retErr != nil {
|
|
|
if c := d.ctr.Decrement(mergedDir); c <= 0 {
|
|
|
- unix.Unmount(mergedDir, 0)
|
|
|
+ if mntErr := unix.Unmount(mergedDir, 0); mntErr != nil {
|
|
|
+ logrus.Errorf("error unmounting %v: %v", mergedDir, mntErr)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}()
|