2017-08-03 22:24:02 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package snapshot
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"github.com/containerd/containerd/mount"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (lm *localMounter) Unmount() error {
|
|
|
|
lm.mu.Lock()
|
|
|
|
defer lm.mu.Unlock()
|
|
|
|
|
|
|
|
if lm.target != "" {
|
|
|
|
if err := mount.Unmount(lm.target, syscall.MNT_DETACH); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
os.RemoveAll(lm.target)
|
|
|
|
lm.target = ""
|
|
|
|
}
|
|
|
|
|
2018-04-16 22:23:10 +00:00
|
|
|
if lm.mountable != nil {
|
|
|
|
return lm.mountable.Release()
|
|
|
|
}
|
|
|
|
|
2017-08-03 22:24:02 +00:00
|
|
|
return nil
|
|
|
|
}
|