github.com/zhouyu0/docker-note@v0.0.0-20190722021225-b8d3825084db/pkg/mount/unmount_unix.go (about)

     1  // +build !windows
     2  
     3  package mount // import "github.com/docker/docker/pkg/mount"
     4  
     5  import "golang.org/x/sys/unix"
     6  
     7  func unmount(target string, flags int) error {
     8  	err := unix.Unmount(target, flags)
     9  	if err == nil || err == unix.EINVAL {
    10  		// Ignore "not mounted" error here. Note the same error
    11  		// can be returned if flags are invalid, so this code
    12  		// assumes that the flags value is always correct.
    13  		return nil
    14  	}
    15  
    16  	return &mountError{
    17  		op:     "umount",
    18  		target: target,
    19  		flags:  uintptr(flags),
    20  		err:    err,
    21  	}
    22  }