graphdriver.Mounted(): ignore ENOENT

In case statfs() returns ENOENT, do not return an error, but rather
treat this as "not mounted".

Related to commit d42dbdd3d4.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin 2019-05-24 12:54:07 -07:00
parent 5b99b33cfb
commit 72ceac6a74
2 changed files with 3 additions and 3 deletions

View file

@ -313,9 +313,6 @@ func (a *Driver) Remove(id string) error {
for {
mounted, err := a.mounted(mountpoint)
if err != nil {
if os.IsNotExist(err) {
break
}
return err
}
if !mounted {

View file

@ -118,6 +118,9 @@ func (c *defaultChecker) IsMounted(path string) bool {
func Mounted(fsType FsMagic, mountPath string) (bool, error) {
var buf unix.Statfs_t
if err := unix.Statfs(mountPath, &buf); err != nil {
if err == unix.ENOENT { // not exist, thus not mounted
err = nil
}
return false, err
}
return FsMagic(buf.Type) == fsType, nil