Skip to content

Commit

Permalink
Merge pull request kubernetes#58433 from yue9944882/bugfix/lstat-pare…
Browse files Browse the repository at this point in the history
…nt-with-abs-path

Automatic merge from submit-queue (batch tested with PRs 59103, 58433). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

bugfix(mount): lstat with abs path of parent instead of '/..'

**What this PR does / why we need it**:

If a nfs volume with improper permission is mounted on a Pod, operation of deleting this Pod will fail and the pod itself will be stuck at a 'TERMINATING' status. Kubelet cannot reconcile it correctly.

This is because kubelet will try to find the mount-point with '..' file which needs `x` permission of dir.  When it's forbidden, the nfs volume will never umount without a correct mount-point finded.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes kubernetes#57095

**Special notes for your reviewer**:

**Release note**:

```release-note
Get parent dir via canonical absolute path when trying to judge mount-point
```
  • Loading branch information
Kubernetes Submit Queue authored Feb 14, 2018
2 parents bc9c6df + c398269 commit f2b6e49
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/util/mount/mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) {
if err != nil {
return true, err
}
rootStat, err := os.Lstat(file + "/..")
rootStat, err := os.Lstat(filepath.Dir(strings.TrimSuffix(file, "/")))
if err != nil {
return true, err
}
Expand Down

0 comments on commit f2b6e49

Please sign in to comment.