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
9e24ccbd
Commit
9e24ccbd
authored
Sep 17, 2018
by
Jan Safranek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed subpath cleanup when /var/lib/kubelet is a symlink.
parent
e763a3c5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
mount.go
pkg/util/mount/mount.go
+7
-2
No files found.
pkg/util/mount/mount.go
View file @
9e24ccbd
...
@@ -251,9 +251,14 @@ func GetDeviceNameFromMount(mounter Interface, mountPath string) (string, int, e
...
@@ -251,9 +251,14 @@ func GetDeviceNameFromMount(mounter Interface, mountPath string) (string, int, e
// It is more extensive than IsLikelyNotMountPoint
// It is more extensive than IsLikelyNotMountPoint
// and it detects bind mounts in linux
// and it detects bind mounts in linux
func
IsNotMountPoint
(
mounter
Interface
,
file
string
)
(
bool
,
error
)
{
func
IsNotMountPoint
(
mounter
Interface
,
file
string
)
(
bool
,
error
)
{
// Resolve any symlinks in file, kernel would do the same and use the resolved path in /proc/mounts
resolvedFile
,
err
:=
mounter
.
EvalHostSymlinks
(
file
)
if
err
!=
nil
{
return
true
,
err
}
// IsLikelyNotMountPoint provides a quick check
// IsLikelyNotMountPoint provides a quick check
// to determine whether file IS A mountpoint
// to determine whether file IS A mountpoint
notMnt
,
notMntErr
:=
mounter
.
IsLikelyNotMountPoint
(
f
ile
)
notMnt
,
notMntErr
:=
mounter
.
IsLikelyNotMountPoint
(
resolvedF
ile
)
if
notMntErr
!=
nil
&&
os
.
IsPermission
(
notMntErr
)
{
if
notMntErr
!=
nil
&&
os
.
IsPermission
(
notMntErr
)
{
// We were not allowed to do the simple stat() check, e.g. on NFS with
// We were not allowed to do the simple stat() check, e.g. on NFS with
// root_squash. Fall back to /proc/mounts check below.
// root_squash. Fall back to /proc/mounts check below.
...
@@ -274,7 +279,7 @@ func IsNotMountPoint(mounter Interface, file string) (bool, error) {
...
@@ -274,7 +279,7 @@ func IsNotMountPoint(mounter Interface, file string) (bool, error) {
return
notMnt
,
mountPointsErr
return
notMnt
,
mountPointsErr
}
}
for
_
,
mp
:=
range
mountPoints
{
for
_
,
mp
:=
range
mountPoints
{
if
mounter
.
IsMountPointMatch
(
mp
,
f
ile
)
{
if
mounter
.
IsMountPointMatch
(
mp
,
resolvedF
ile
)
{
notMnt
=
false
notMnt
=
false
break
break
}
}
...
...
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