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
59ee7353
Unverified
Commit
59ee7353
authored
Mar 06, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Mar 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74625 from davidz627/fix/xfsUnmount
GetMountRefs fixed to handle corrupted mounts by treating it like an unmounted volume
parents
bd8eeaaa
5bf970f8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
12 deletions
+19
-12
mount_helper.go
pkg/util/mount/mount_helper.go
+1
-1
mount_linux.go
pkg/util/mount/mount_linux.go
+7
-3
mount_windows.go
pkg/util/mount/mount_windows.go
+7
-3
nsenter_mount.go
pkg/util/mount/nsenter_mount.go
+4
-5
No files found.
pkg/util/mount/mount_helper.go
View file @
59ee7353
...
@@ -120,5 +120,5 @@ func IsCorruptedMnt(err error) bool {
...
@@ -120,5 +120,5 @@ func IsCorruptedMnt(err error) bool {
underlyingError
=
pe
.
Err
underlyingError
=
pe
.
Err
}
}
return
underlyingError
==
syscall
.
ENOTCONN
||
underlyingError
==
syscall
.
ESTALE
||
underlyingError
==
syscall
.
EIO
return
underlyingError
==
syscall
.
ENOTCONN
||
underlyingError
==
syscall
.
ESTALE
||
underlyingError
==
syscall
.
EIO
||
underlyingError
==
syscall
.
EACCES
}
}
pkg/util/mount/mount_linux.go
View file @
59ee7353
...
@@ -718,10 +718,14 @@ func getSELinuxSupport(path string, mountInfoFilename string) (bool, error) {
...
@@ -718,10 +718,14 @@ func getSELinuxSupport(path string, mountInfoFilename string) (bool, error) {
}
}
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
func
(
mounter
*
Mounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
if
_
,
err
:=
os
.
Stat
(
pathname
);
os
.
IsNotExist
(
err
)
{
pathExists
,
pathErr
:=
PathExists
(
pathname
)
if
!
pathExists
{
return
[]
string
{},
nil
return
[]
string
{},
nil
}
else
if
err
!=
nil
{
}
else
if
IsCorruptedMnt
(
pathErr
)
{
return
nil
,
err
klog
.
Warningf
(
"GetMountRefs found corrupted mount at %s, treating as unmounted path"
,
pathname
)
return
[]
string
{},
nil
}
else
if
pathErr
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"error checking path %s: %v"
,
pathname
,
pathErr
)
}
}
realpath
,
err
:=
filepath
.
EvalSymlinks
(
pathname
)
realpath
,
err
:=
filepath
.
EvalSymlinks
(
pathname
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/util/mount/mount_windows.go
View file @
59ee7353
...
@@ -378,10 +378,14 @@ func getAllParentLinks(path string) ([]string, error) {
...
@@ -378,10 +378,14 @@ 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
)
{
if
_
,
err
:=
os
.
Stat
(
normalizeWindowsPath
(
pathname
));
os
.
IsNotExist
(
err
)
{
pathExists
,
pathErr
:=
PathExists
(
normalizeWindowsPath
(
pathname
))
// TODO(#75012): Need a Windows specific IsCorruptedMnt function that checks against whatever errno's
// Windows emits when we try to Stat a corrupted mount
// https://golang.org/pkg/syscall/?GOOS=windows&GOARCH=amd64#Errno
if
!
pathExists
{
return
[]
string
{},
nil
return
[]
string
{},
nil
}
else
if
e
rr
!=
nil
{
}
else
if
pathE
rr
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"error checking path %s: %v"
,
normalizeWindowsPath
(
pathname
),
pathErr
)
}
}
return
[]
string
{
pathname
},
nil
return
[]
string
{
pathname
},
nil
}
}
...
...
pkg/util/mount/nsenter_mount.go
View file @
59ee7353
...
@@ -297,12 +297,11 @@ func (mounter *NsenterMounter) EvalHostSymlinks(pathname string) (string, error)
...
@@ -297,12 +297,11 @@ func (mounter *NsenterMounter) EvalHostSymlinks(pathname string) (string, error)
}
}
func
(
mounter
*
NsenterMounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
func
(
mounter
*
NsenterMounter
)
GetMountRefs
(
pathname
string
)
([]
string
,
error
)
{
exists
,
err
:=
mounter
.
ExistsPath
(
pathname
)
pathExists
,
pathErr
:=
PathExists
(
pathname
)
if
err
!=
nil
{
if
!
pathExists
||
IsCorruptedMnt
(
pathErr
)
{
return
nil
,
err
}
if
!
exists
{
return
[]
string
{},
nil
return
[]
string
{},
nil
}
else
if
pathErr
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Error checking path %s: %v"
,
pathname
,
pathErr
)
}
}
hostpath
,
err
:=
mounter
.
ne
.
EvalSymlinks
(
pathname
,
true
/* mustExist */
)
hostpath
,
err
:=
mounter
.
ne
.
EvalSymlinks
(
pathname
,
true
/* mustExist */
)
if
err
!=
nil
{
if
err
!=
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