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
Skip mount point checks when possible during mount cleanup. #109676
Skip mount point checks when possible during mount cleanup. #109676
Conversation
Please note that we're already in Test Freeze for the |
@cartermckinnon: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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. |
Hi @cartermckinnon. 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. |
@@ -244,6 +244,11 @@ func (mounter *Mounter) IsLikelyNotMountPoint(file string) (bool, error) { | |||
return true, nil | |||
} | |||
|
|||
// CanSafelySkipMountPointCheck always returns false on Windows | |||
func (mounter *Mounter) CanSafelySkipMountPointCheck() bool { | |||
return false |
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 used false
here to avoid changing any behavior on Windows; but looking at the Unmount
implementation, I think this might be fine to return true
?
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.
ya I see the same, it won't make a difference since windows mounter.List
does nothing and has a todo
// List returns a list of all mounted filesystems. todo |
List
todo to figure out when/if CanSafelySkipMountPointCheck should ever return true
This PR may require API review. If so, when the changes are ready, complete the pre-review checklist and request an API review. Status of requested reviews is tracked in the API Review project. |
/ok-to-test |
@@ -303,6 +339,9 @@ func (mounter *Mounter) Unmount(target string) error { | |||
// Rewrite err with the actual exit error of the process. | |||
err = &exec.ExitError{ProcessState: command.ProcessState} | |||
} | |||
if mounter.withSafeNotMountedBehavior && strings.Contains(string(output), errNotMounted) { |
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.
is this in the right place? if umount exits 1 I think err will be non-nil so this belongs in the above if statement. Will need to test.
- create Pod with a volume
- ssh onto Node and unmount one of its volumes
- delete Pod
- does this condition actually get hit?
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 within the if err != nil {}
block; and I think it should come after the ErrNoChildProcess
check (as is). I'll do that test, to confirm.
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.
put a log here, and update Unmount comment.
Since we are changing the library here, we also need to make sure this behavior change will not affect any other logic.
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.
many in-tree drivers uses this function, could you double check this behavior change will not affect any of them?
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.
also if mount is bad/ corrupted, is it possible that "unmount" returns message "is not a mount point"?
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 don't have all the context on what qualifies as corrupted; but all such not mounted
errors will be silenced after this PR (if the mounter supports it). I can't find any in-tree drivers that rely on this error message (or any specific error message), so I'm not concerned about silencing it.
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.
From a quick search, I think corrupted mounts often result in failed: Operation not permitted
from umount
. That behavior won't change with this PR, the error will be returned.
/retest |
I'm not able to reproduce this test failure using:
The line immediately preceding the failed assertion is a sleep statement: https://github.com/cartermckinnon/kubernetes/blob/master/pkg/controller/volume/attachdetach/reconciler/reconciler_test.go#L655 I'm going to try it again, but this seems like flakiness that isn't related to the changes in this PR. |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cartermckinnon, jingxu97, manugupt1, wongma7 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 |
Thank you very much for the great effort on this PR! Sorry for the delayed review. |
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
Recently the k8s.io/mount-utils package added more runtime dectection. When creating a new Mounter, the detect is run every time. This is unfortunate, as it logs a message like the following: ``` mount_linux.go:283] Detected umount with safe 'not mounted' behavior ``` This message might be useful, so it probably good to keep it. In Ceph-CSI there are various locations where Mounter instances are created. Moving that to the DefaultNodeServer type reduces it to a single place. Some utility functions need to accept the additional parameter too, so that has been modified as well. See-also: kubernetes/kubernetes#109676 Signed-off-by: Niels de Vos <ndevos@redhat.com>
Recently the k8s.io/mount-utils package added more runtime dectection. When creating a new Mounter, the detect is run every time. This is unfortunate, as it logs a message like the following: ``` mount_linux.go:283] Detected umount with safe 'not mounted' behavior ``` This message might be useful, so it probably good to keep it. In Ceph-CSI there are various locations where Mounter instances are created. Moving that to the DefaultNodeServer type reduces it to a single place. Some utility functions need to accept the additional parameter too, so that has been modified as well. See-also: kubernetes/kubernetes#109676 Signed-off-by: Niels de Vos <ndevos@redhat.com>
Recently the k8s.io/mount-utils package added more runtime dectection. When creating a new Mounter, the detect is run every time. This is unfortunate, as it logs a message like the following: ``` mount_linux.go:283] Detected umount with safe 'not mounted' behavior ``` This message might be useful, so it probably good to keep it. In Ceph-CSI there are various locations where Mounter instances are created. Moving that to the DefaultNodeServer type reduces it to a single place. Some utility functions need to accept the additional parameter too, so that has been modified as well. See-also: kubernetes/kubernetes#109676 Signed-off-by: Niels de Vos <ndevos@redhat.com>
Recently the k8s.io/mount-utils package added more runtime dectection. When creating a new Mounter, the detect is run every time. This is unfortunate, as it logs a message like the following: ``` mount_linux.go:283] Detected umount with safe 'not mounted' behavior ``` This message might be useful, so it probably good to keep it. In Ceph-CSI there are various locations where Mounter instances are created. Moving that to the DefaultNodeServer type reduces it to a single place. Some utility functions need to accept the additional parameter too, so that has been modified as well. See-also: kubernetes/kubernetes#109676 Signed-off-by: Niels de Vos <ndevos@redhat.com>
Recently the k8s.io/mount-utils package added more runtime dectection. When creating a new Mounter, the detect is run every time. This is unfortunate, as it logs a message like the following: ``` mount_linux.go:283] Detected umount with safe 'not mounted' behavior ``` This message might be useful, so it probably good to keep it. In Ceph-CSI there are various locations where Mounter instances are created. Moving that to the DefaultNodeServer type reduces it to a single place. Some utility functions need to accept the additional parameter too, so that has been modified as well. See-also: kubernetes/kubernetes#109676 Signed-off-by: Niels de Vos <ndevos@redhat.com>
…ounts Skip mount point checks when possible during mount cleanup.
…#109676-upstream-release-1.24 Automated cherry pick of #109676: Skip mount point checks when possible during mount
…nup. Description: * "Calls to mounter.Unmount are preceded and followed by expensive mount point checks. These checks are not necessary on *nix-s with a umount implementation that performs a similar check itself. This PR adds a mechanism to detect the "safe" behavior, and avoid mount point checks when possible. This change represents a significant optimization of CleanupMountPoint; enabling use-cases where pods have many mounts, and there is high pod churn. We (EKS) have observed several cases of instability and poor node health in such scenarios, which were resolved with this change." (PR description) Upstream PR, Issue, KEP, etc. links: * Cherry pick of upstream Kubernetes PR kubernetes#109676 (kubernetes#109676) If this patch is based on an upstream commit, how (if at all) do this patch and the upstream source differ? * No differences If this patch's changes have not been added by upstream, why not? * N/A Other patches related to this patch: * None Changes made to this patch after its initial creation and reasons for these changes: * None Kubernetes version this patch can be dropped: * v1.25 -- upstream includes these changes starting in this version Signed-off-by: Davanum Srinivas <davanum@gmail.com>
…possible during mount cleanup
cherrypick kubernetes#109676 - 1.20 See merge request eks-dataplane/eks-kubernetes-patches!22
cherrypick kubernetes#109676 - 1.22 See merge request eks-dataplane/eks-kubernetes-patches!24
cherrypick kubernetes#109676 - 1.23 See merge request eks-dataplane/eks-kubernetes-patches!21
cherrypick kubernetes#109676 - 1.21 See merge request eks-dataplane/eks-kubernetes-patches!28
What type of PR is this?
/kind bug
/kind api-change
What this PR does / why we need it:
This is a continuation of #109117. Please see that PR for more background.
Calls to
mounter.Unmount
are preceded and followed by expensive mount point checks. These checks are not necessary on *nix-s with aumount
implementation that performs a similar check itself. This PR adds a mechanism to detect the "safe" behavior, and avoid mount point checks when possible.This change represents a significant optimization of
CleanupMountPoint
; enabling use-cases where pods have many mounts, and there is high pod churn. We (EKS) have observed several cases of instability and poor node health in such scenarios, which were resolved with this change.Which issue(s) this PR fixes:
No issue available.
Special notes for your reviewer:
I chose to add a function to the
Mounter
interface in order to keep theCleanupMountPoint
implementation generic for Unix and Windows. If the "safe"umount
behavior is not detected, the existing code paths are unchanged.Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: