Rename IsMountPoint to IsLikelyNotMountPoint
IsLikelyNotMountPoint determines if a directory is not a mountpoint. 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. mkdir /tmp/a /tmp/b; mount --bin /tmp/a /tmp/b; IsLikelyNotMountPoint("/tmp/b") will return true. When in fact /tmp/b is a mount point. So this patch renames the function and switches it from a positive to a negative (I could think of a good positive name). This should make future users of this function aware that it isn't quite perfect, but probably good enough.
This commit is contained in:
@@ -111,7 +111,7 @@ func (b *secretVolumeBuilder) getMetaDir() string {
|
||||
}
|
||||
|
||||
func (b *secretVolumeBuilder) SetUpAt(dir string) error {
|
||||
isMnt, err := b.mounter.IsMountPoint(dir)
|
||||
notMnt, err := b.mounter.IsLikelyNotMountPoint(dir)
|
||||
// Getting an os.IsNotExist err from is a contingency; the directory
|
||||
// may not exist yet, in which case, setup should run.
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
@@ -120,7 +120,7 @@ func (b *secretVolumeBuilder) SetUpAt(dir string) error {
|
||||
|
||||
// If the plugin readiness file is present for this volume and
|
||||
// the setup dir is a mountpoint, this volume is already ready.
|
||||
if volumeutil.IsReady(b.getMetaDir()) && isMnt {
|
||||
if volumeutil.IsReady(b.getMetaDir()) && !notMnt {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user