Fixed TearDown of NFS with root squash.

NFS plugin should not use IsLikelyNotMountPoint(), as it uses lstat() / stat()
to determine if the NFS volume is still mounted - NFS server may use
root_squash and kubelet may not be allowed to do lstat() / stat() there.

It must use slower IsNotMountPoint() instead, including TearDown() function.
This commit is contained in:
Jan Safranek
2018-01-08 14:01:33 +01:00
parent 51acead084
commit 45d21ee36b
2 changed files with 14 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ limitations under the License.
package mount
import (
"os"
"path/filepath"
)
@@ -208,6 +209,12 @@ func IsNotMountPoint(mounter Interface, file string) (bool, error) {
// IsLikelyNotMountPoint provides a quick check
// to determine whether file IS A mountpoint
notMnt, notMntErr := mounter.IsLikelyNotMountPoint(file)
if notMntErr != nil && os.IsPermission(notMntErr) {
// We were not allowed to do the simple stat() check, e.g. on NFS with
// root_squash. Fall back to /proc/mounts check below.
notMnt = true
notMntErr = nil
}
if notMntErr != nil {
return notMnt, notMntErr
}