Unverified Commit d8c33485 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #74880 from smileusd/fix-IsLikelyNotMountPoint-function

distinguish between mountpoints and symbolic link in IsNotMountPoint
parents c2633d89 a81f7704
...@@ -53,7 +53,7 @@ type Interface interface { ...@@ -53,7 +53,7 @@ type Interface interface {
// is a mountpoint. // is a mountpoint.
// It should return ErrNotExist when the directory does not exist. // It should return ErrNotExist when the directory does not exist.
// IsLikelyNotMountPoint does NOT properly detect all mountpoint types // IsLikelyNotMountPoint does NOT properly detect all mountpoint types
// most notably linux bind mounts. // most notably linux bind mounts and symbolic link.
IsLikelyNotMountPoint(file string) (bool, error) IsLikelyNotMountPoint(file string) (bool, error)
// DeviceOpened determines if the device is in use elsewhere // DeviceOpened determines if the device is in use elsewhere
// on the system, i.e. still mounted. // on the system, i.e. still mounted.
......
...@@ -228,6 +228,7 @@ func (mounter *Mounter) IsMountPointMatch(mp MountPoint, dir string) bool { ...@@ -228,6 +228,7 @@ func (mounter *Mounter) IsMountPointMatch(mp MountPoint, dir string) bool {
// IsLikelyNotMountPoint determines if a directory is not a mountpoint. // IsLikelyNotMountPoint determines if a directory is not a mountpoint.
// It is fast but not necessarily ALWAYS correct. If the path is in fact // It is fast but not necessarily ALWAYS correct. If the path is in fact
// a bind mount from one part of a mount to another it will not be detected. // a bind mount from one part of a mount to another it will not be detected.
// It also can not distinguish between mountpoints and symbolic links.
// mkdir /tmp/a /tmp/b; mount --bind /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b") // mkdir /tmp/a /tmp/b; mount --bind /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b")
// will return true. When in fact /tmp/b is a mount point. If this situation // will return true. When in fact /tmp/b is a mount point. If this situation
// if of interest to you, don't use this function... // if of interest to you, don't use this function...
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment