Skip to content

Commit 1c9b573

Browse files
authored
Merge pull request #75 from andyzhangx/smb-valid-path-fix
fix: smb valid path error
2 parents d8709d1 + 150f8c7 commit 1c9b573

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

internal/server/smb/server.go

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,21 @@ func (s *Server) NewSmbGlobalMapping(context context.Context, request *internal.
4545
isMapped = false
4646
}
4747

48-
valid, err := s.fsServer.PathValid(context, remotePath)
49-
if err != nil {
50-
klog.Errorf("PathValid(%s) failed with %v", remotePath, err)
51-
return response, fmt.Errorf("PathValid(%s) failed with %v", remotePath, err)
52-
}
53-
54-
if isMapped && !valid {
55-
klog.V(4).Infof("Remote %s is not valid, removing now", remotePath)
56-
err := s.hostAPI.RemoveSmbGlobalMapping(remotePath)
48+
if isMapped {
49+
valid, err := s.fsServer.PathValid(context, remotePath)
5750
if err != nil {
58-
klog.Errorf("RemoveSmbGlobalMapping(%s) failed with %v", remotePath, err)
59-
return response, err
51+
klog.Warningf("PathValid(%s) failed with %v, ignore error", remotePath, err)
52+
}
53+
54+
if !valid {
55+
klog.V(4).Infof("RemotePath %s is not valid, removing now", remotePath)
56+
err := s.hostAPI.RemoveSmbGlobalMapping(remotePath)
57+
if err != nil {
58+
klog.Errorf("RemoveSmbGlobalMapping(%s) failed with %v", remotePath, err)
59+
return response, err
60+
}
61+
isMapped = false
6062
}
61-
isMapped = false
6263
}
6364

6465
if !isMapped {

0 commit comments

Comments
 (0)