Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #24035 #24523

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions pkg/util/mount/nsenter_mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (n *NsenterMounter) doNsenterMount(source, target, fstype string, options [
exec := exec.New()
outputBytes, err := exec.Command(nsenterPath, args...).CombinedOutput()
if len(outputBytes) != 0 {
glog.V(5).Infof("Output from mount command: %v", string(outputBytes))
glog.V(5).Infof("Output of mounting %s to %s: %v", source, target, string(outputBytes))
}

return err
Expand Down Expand Up @@ -151,7 +151,7 @@ func (n *NsenterMounter) Unmount(target string) error {
exec := exec.New()
outputBytes, err := exec.Command(nsenterPath, args...).CombinedOutput()
if len(outputBytes) != 0 {
glog.V(5).Infof("Output from mount command: %v", string(outputBytes))
glog.V(5).Infof("Output of unmounting %s: %v", target, string(outputBytes))
}

return err
Expand Down Expand Up @@ -182,15 +182,15 @@ func (n *NsenterMounter) IsLikelyNotMountPoint(file string) (bool, error) {
exec := exec.New()
out, err := exec.Command(nsenterPath, args...).CombinedOutput()
if err != nil {
glog.V(2).Infof("Failed findmnt command: %v", err)
glog.V(2).Infof("Failed findmnt command for path %s: %v", file, err)
// Different operating systems behave differently for paths which are not mount points.
// On older versions (e.g. 2.20.1) we'd get error, on newer ones (e.g. 2.26.2) we'd get "/".
// It's safer to assume that it's not a mount point.
return true, nil
}
strOut := strings.TrimSuffix(string(out), "\n")

glog.V(5).Infof("IsLikelyNotMountPoint findmnt output: %v", strOut)
glog.V(5).Infof("IsLikelyNotMountPoint findmnt output for path %s: %v", file, strOut)
if strOut == file {
return false, nil
}
Expand Down