[4.7] Cgroup v1 removal nits/fixes#6
Merged
mrunalp merged 4 commits intoOct 21, 2020
Conversation
RemovePaths() deletes elements from the paths map for paths that has been successfully removed. Although, it does not empty the map itself (which is needed that AFAIK Go garbage collector does not shrink the map), but all its callers do. Move this operation from callers to RemovePaths. No functional change, except the old map should be garbage collected now. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 254d23b) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This is to be used by RemovePaths. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 3f14242) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Using os.RemoveAll has the following two issues: 1. it tries to remove all files, which does not make sense for cgroups; 2. it tries rm(2) which fails to directories, and then rmdir(2). Let's reuse our RemovePath instead, and add warnings and errors logging. PS I am somewhat hesitant to remove the weird checking my means of stat, as it might break something. Unfortunately, neither commit 6feb7bd nor the PR it contains [1] do not explain what kind of weird errors were seen from os.RemoveAll. Most probably our code won't return any bogus errors, but let's keep the old code to be on the safe side. [1] docker-archive/libcontainer#308 Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 19be8e5) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This is similar to what we did before for v2. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 335f080) Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
mrunalp
approved these changes
Oct 21, 2020
Member
|
/lgtm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of opencontainers#2506 to a runc version currently used by openshift/kubernetes master. For more info, see the above PR and/or individual commits.
For one thing, this adds logging to unsuccessful cgroup removal attempts.