Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
43b6ddf3
Unverified
Commit
43b6ddf3
authored
Mar 11, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 11, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75087 from andyzhangx/unmount-issue-windows
fix smb unmount issue on Windows
parents
243e7408
720a5e20
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
121 additions
and
27 deletions
+121
-27
BUILD
pkg/util/mount/BUILD
+3
-1
mount_helper_common.go
pkg/util/mount/mount_helper_common.go
+0
-21
mount_helper_unix.go
pkg/util/mount/mount_helper_unix.go
+44
-0
mount_helper_windows.go
pkg/util/mount/mount_helper_windows.go
+68
-0
mount_windows.go
pkg/util/mount/mount_windows.go
+6
-5
No files found.
pkg/util/mount/BUILD
View file @
43b6ddf3
...
@@ -9,7 +9,9 @@ go_library(
...
@@ -9,7 +9,9 @@ go_library(
"exec_mount_unsupported.go",
"exec_mount_unsupported.go",
"fake.go",
"fake.go",
"mount.go",
"mount.go",
"mount_helper.go",
"mount_helper_common.go",
"mount_helper_unix.go",
"mount_helper_windows.go",
"mount_linux.go",
"mount_linux.go",
"mount_unsupported.go",
"mount_unsupported.go",
"mount_windows.go",
"mount_windows.go",
...
...
pkg/util/mount/mount_helper.go
→
pkg/util/mount/mount_helper
_common
.go
View file @
43b6ddf3
...
@@ -19,7 +19,6 @@ package mount
...
@@ -19,7 +19,6 @@ package mount
import
(
import
(
"fmt"
"fmt"
"os"
"os"
"syscall"
"k8s.io/klog"
"k8s.io/klog"
)
)
...
@@ -102,23 +101,3 @@ func PathExists(path string) (bool, error) {
...
@@ -102,23 +101,3 @@ func PathExists(path string) (bool, error) {
return
false
,
err
return
false
,
err
}
}
}
}
// IsCorruptedMnt return true if err is about corrupted mount point
func
IsCorruptedMnt
(
err
error
)
bool
{
if
err
==
nil
{
return
false
}
var
underlyingError
error
switch
pe
:=
err
.
(
type
)
{
case
nil
:
return
false
case
*
os
.
PathError
:
underlyingError
=
pe
.
Err
case
*
os
.
LinkError
:
underlyingError
=
pe
.
Err
case
*
os
.
SyscallError
:
underlyingError
=
pe
.
Err
}
return
underlyingError
==
syscall
.
ENOTCONN
||
underlyingError
==
syscall
.
ESTALE
||
underlyingError
==
syscall
.
EIO
||
underlyingError
==
syscall
.
EACCES
}
pkg/util/mount/mount_helper_unix.go
0 → 100644
View file @
43b6ddf3
// +build !windows
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
mount
import
(
"os"
"syscall"
)
// IsCorruptedMnt return true if err is about corrupted mount point
func
IsCorruptedMnt
(
err
error
)
bool
{
if
err
==
nil
{
return
false
}
var
underlyingError
error
switch
pe
:=
err
.
(
type
)
{
case
nil
:
return
false
case
*
os
.
PathError
:
underlyingError
=
pe
.
Err
case
*
os
.
LinkError
:
underlyingError
=
pe
.
Err
case
*
os
.
SyscallError
:
underlyingError
=
pe
.
Err
}
return
underlyingError
==
syscall
.
ENOTCONN
||
underlyingError
==
syscall
.
ESTALE
||
underlyingError
==
syscall
.
EIO
||
underlyingError
==
syscall
.
EACCES
}
pkg/util/mount/mount_helper_windows.go
0 → 100644
View file @
43b6ddf3
// +build windows
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
mount
import
(
"os"
"syscall"
"k8s.io/klog"
)
// following failure codes are from https://docs.microsoft.com/en-us/windows/desktop/debug/system-error-codes--1300-1699-
// ERROR_BAD_NETPATH = 53
// ERROR_NETWORK_BUSY = 54
// ERROR_UNEXP_NET_ERR = 59
// ERROR_NETNAME_DELETED = 64
// ERROR_NETWORK_ACCESS_DENIED = 65
// ERROR_BAD_DEV_TYPE = 66
// ERROR_BAD_NET_NAME = 67
// ERROR_SESSION_CREDENTIAL_CONFLICT = 1219
// ERROR_LOGON_FAILURE = 1326
var
errorNoList
=
[
...
]
int
{
53
,
54
,
59
,
64
,
65
,
66
,
67
,
1219
,
1326
}
// IsCorruptedMnt return true if err is about corrupted mount point
func
IsCorruptedMnt
(
err
error
)
bool
{
if
err
==
nil
{
return
false
}
var
underlyingError
error
switch
pe
:=
err
.
(
type
)
{
case
nil
:
return
false
case
*
os
.
PathError
:
underlyingError
=
pe
.
Err
case
*
os
.
LinkError
:
underlyingError
=
pe
.
Err
case
*
os
.
SyscallError
:
underlyingError
=
pe
.
Err
}
if
ee
,
ok
:=
underlyingError
.
(
syscall
.
Errno
);
ok
{
for
_
,
errno
:=
range
errorNoList
{
if
int
(
ee
)
==
errno
{
klog
.
Warningf
(
"IsCorruptedMnt failed with error: %v, error code: %v"
,
err
,
errno
)
return
true
}
}
}
return
false
}
pkg/util/mount/mount_windows.go
View file @
43b6ddf3
...
@@ -378,14 +378,15 @@ func getAllParentLinks(path string) ([]string, error) {
...
@@ -378,14 +378,15 @@ func getAllParentLinks(path string) ([]string, error) {
// GetMountRefs : empty implementation here since there is no place to query all mount points on Windows
// GetMountRefs : empty implementation here since there is no place to query all mount points on Windows
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
pathExists
,
pathErr
:=
PathExists
(
normalizeWindowsPath
(
pathname
))
windowsPath
:=
normalizeWindowsPath
(
pathname
)
// TODO(#75012): Need a Windows specific IsCorruptedMnt function that checks against whatever errno's
pathExists
,
pathErr
:=
PathExists
(
windowsPath
)
// Windows emits when we try to Stat a corrupted mount
// https://golang.org/pkg/syscall/?GOOS=windows&GOARCH=amd64#Errno
if
!
pathExists
{
if
!
pathExists
{
return
[]
string
{},
nil
return
[]
string
{},
nil
}
else
if
IsCorruptedMnt
(
pathErr
)
{
klog
.
Warningf
(
"GetMountRefs found corrupted mount at %s, treating as unmounted path"
,
windowsPath
)
return
[]
string
{},
nil
}
else
if
pathErr
!=
nil
{
}
else
if
pathErr
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"error checking path %s: %v"
,
normalizeWindowsPath
(
pathname
)
,
pathErr
)
return
nil
,
fmt
.
Errorf
(
"error checking path %s: %v"
,
windowsPath
,
pathErr
)
}
}
return
[]
string
{
pathname
},
nil
return
[]
string
{
pathname
},
nil
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment