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
Fix loopback device lookup #96889
Fix loopback device lookup #96889
Conversation
/priority important-soon |
/triage accepted |
Btw, I checked the rest of volume_path_handler_linux.go and the rest does not need symlink expansion. |
realPath, err := filepath.EvalSymlinks(path) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to evaluate path %s: %s", path, err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we instead call losetup
on expanded path, so as if behaviour of losetup changes in future - we don't break anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think evaluating paths before calling losetup is not useful. But I see your point, I added check for both realPath
and original path
, just in case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think evaluating paths before calling losetup is not useful.
Can you explain why is it not useful? Do you foresee any breakage? From very afar it sounds like it is better to pass expanded path to losetup and scan for only one path rather than two (both real and symlink).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The initial concern was that losetup can change in the future and it may not expand symlinks in losetup -j
output. So if it lists symlinks instead of evaluating them, we should check for the unevaluated path too.
In case /var/lib/kubelet is a symlink, "losetup -j <device in /var/lib/kubelet>" will show the device paths with symlinks fully evaluated. Fix the parsing routine and expand symlinks in the path that we want to find in "losetup -j" output.
bb498e4
to
357a8c3
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gnufied, jsafrane The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Review the full test history for this PR. Silence the bot with an |
1 similar comment
/retest Review the full test history for this PR. Silence the bot with an |
In case
/var/lib/kubelet
is a symlink,losetup -j <device in/var/lib/kubelet>
will show the device paths with symlinks fully evaluated.Fix the routine that parses
losetup -j
and expand symlinks in the path that we want to find there./kind bug
Which issue(s) this PR fixes:
Fixes #96888
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: