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
Improved mount detection using openat2 for kernel 5.10+ #109217
Improved mount detection using openat2 for kernel 5.10+ #109217
Conversation
Hi @manugupt1. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/kind cleanup |
/ok-to-test |
Can this mountedFast function is also used by IsNotMountPoint? Is it work for bind mount too? |
Only for kernel 5.10+ / when openat2 is supported: https://github.com/moby/sys/blob/main/mountinfo/mounted_linux_test.go#L303-L320 |
// IsNotMountPoint enumerates all the mountpoints using List() and | ||
// the list of mountpoints may be large, then it uses | ||
// isMountPointMatch to evaluate whether the directory is a mountpoint. | ||
func IsNotMountPoint(mounter Interface, file string) (bool, error) { |
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.
This is mount_unsupported.go
, I think returning errUnsupported
is perfectly fine here.
b33ad58
to
a5ab6db
Compare
a5ab6db
to
4f62d65
Compare
Reimplement IsNotMountpoint as IsMountPoint and return appropriate error when a mount point is not detected. IsMountPoint depends on MountedFast function in moby/sys/mountinfo that uses openat2 call in kernel versions5.10 to detect mount points without falling back to /proc/mounts. Mark IsNotMountPoint as deprecated in order to ask the users to use IsMountPoint directly.
By default filepath.EvalSymlink returns PathError. When a file is not found, we should unwrap it and return ErrNotExist as this is what this function expects. Similar to the comment at: kubernetes#109217 (comment)
4f62d65
to
44bea35
Compare
@manugupt1: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/test pull-kubernetes-verify-govet-levee |
/lgtm in release note, maybe mention that for old kernel version, it will fall back to the original way to check mount point. |
@liggitt the change looks good to me. Thanks! |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jingxu97, liggitt, manugupt1 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 |
/test pull-kubernetes-e2e-capz-windows-containerd |
/triage accepted |
By default filepath.EvalSymlink returns PathError. When a file is not found, we should unwrap it and return ErrNotExist as this is what this function expects. Similar to the comment at: kubernetes/kubernetes#109217 (comment) Kubernetes-commit: 44bea358045e09f228ee0fbc594ec0f77bc71112
What type of PR is this?
/kind cleanup
/kind cleanup
What this PR does / why we need it:
Faster mount detection for linux kernel 5.10+ using openat2 speeding up pod churn rates.
Which issue(s) this PR fixes:
Fixes # #105642
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: