File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change 11package filesystem
22
33import (
4- "fmt"
54 "os"
65 "path/filepath"
76
@@ -112,23 +111,16 @@ func (filesystemAPI) IsSymlink(tgt string) (bool, error) {
112111 // This code is similar to k8s.io/kubernetes/pkg/util/mount except the pathExists usage.
113112 // Also in a remote call environment the os error cannot be passed directly back, hence the callers
114113 // are expected to perform the isExists check before calling this call in CSI proxy.
115- stat , err := os . Lstat (tgt )
114+ isSymlink , err := utils . IsPathSymlink (tgt )
116115 if err != nil {
117116 return false , err
118117 }
119118
120- // If its a link and it points to an existing file then its a mount point.
121- if stat .Mode ()& os .ModeSymlink != 0 {
122- target , err := os .Readlink (tgt )
123- if err != nil {
124- return false , fmt .Errorf ("readlink error: %v" , err )
125- }
126- exists , err := pathExists (target )
127- if err != nil {
128- return false , err
129- }
130- return exists , nil
119+ // mounted folder created by SetVolumeMountPoint may still report ModeSymlink == 0
120+ mountedFolder , err := utils .IsMountedFolder (tgt )
121+ if err != nil {
122+ return false , err
131123 }
132124
133- return false , nil
125+ return isSymlink || mountedFolder , nil
134126}
You can’t perform that action at this time.
0 commit comments