Skip to content

Commit

Permalink
Merge pull request kubernetes#86277 from yutedz/subpath-walk-nil
Browse files Browse the repository at this point in the history
Check FileInfo against nil during walk of container dir path
  • Loading branch information
k8s-ci-robot committed Dec 17, 2019
2 parents f06a380 + 62d7772 commit a57a8f3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/volume/util/subpath/subpath_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ func doCleanSubPaths(mounter mount.Interface, podDir string, volumeName string)
return err
}

if info.IsDir() {
// We need to check that info is not nil. This may happen when the incoming err is not nil due to stale mounts or permission errors.
if info != nil && info.IsDir() {
// skip subdirs of the volume: it only matters the first level to unmount, otherwise it would try to unmount subdir of the volume
return filepath.SkipDir
}
Expand Down

0 comments on commit a57a8f3

Please sign in to comment.