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

Partially revert "CreateCgroupPath: only enable needed controllers" #2395

Merged
merged 2 commits into from
May 25, 2020

Conversation

lifubang
Copy link
Member

@lifubang lifubang commented May 10, 2020

fix #2394

  1. Partially revert "CreateCgroupPath: only enable needed controllers"
    Because if we update a resource which did not limited in the beginning, it will
    have no effective.
  2. Returns err if we use an non enabled controller, or else the user may feel success, but actually
    there are no effective.

For #2367 , I think we don't need fully revert 4b4bc99 , because rootless need some part in it to check errors.

Signed-off-by: lifubang [email protected]

@lifubang
Copy link
Member Author

CI error:

# time="2020-05-10T02:06:34Z" level=error msg="container_linux.go:348: starting container process caused: process_linux.go:438: container init caused: process_linux.go:404: setting cgroup config for procHooks process caused: failed to write \"33554432\" to \"/sys/fs/cgroup/runc-cgroups-integration-test/test-cgroup/memory.max\": open /sys/fs/cgroup/runc-cgroups-integration-test/test-cgroup/memory.max: permission denied"

I think this error is ignored in the past.
So, I think we need #2390 to fix this error.

@lifubang lifubang marked this pull request as draft May 10, 2020 23:18
@lifubang
Copy link
Member Author

Waiting for #2390 complete.

@kolyshkin
Copy link
Contributor

@lifubang #2390 is now merged

@lifubang lifubang marked this pull request as ready for review May 13, 2020 23:08
// pids (since kernel 4.5)
if _, ok := m.controllers["pids"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this function was the only user of controllers map. If there aren't any left, remove it altogether.

Maybe as a separate patch, describing why there's no need for this map and check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, there is another user: GetStats!

@kolyshkin
Copy link
Contributor

Left a number of comments. It's better to split this into a few smaller patches as there are a few independent things being fixed.

@lifubang
Copy link
Member Author

lifubang commented May 14, 2020

It's better to split this into a few smaller patches as there are a few independent things being fixed.

I quite agree with you. And the purpose of this patch is to let runc update work.
After this fix, you can do more refactoring works.

@lifubang lifubang marked this pull request as draft May 14, 2020 00:46
@lifubang lifubang marked this pull request as ready for review May 18, 2020 23:24
@lifubang
Copy link
Member Author

As #2390 and #2410 has been merged, so set this PR ready for review.

@AkihiroSuda
Copy link
Member

AkihiroSuda commented May 20, 2020

LGTM, can we also have tests?

Approved with PullApprove

@lifubang
Copy link
Member Author

LGTM, can we also have tests?

Yes, I think we should add some test cases. I'll add it later.

@lifubang lifubang force-pushed the updateCgroupv2 branch 2 times, most recently from 9e4e363 to 1ed174f Compare May 20, 2020 16:18
@AkihiroSuda
Copy link
Member

AkihiroSuda commented May 20, 2020

LGTM (if green)

Approved with PullApprove

if _, ok := avail[controller]; ok {
list = append(list, "+"+controller)
return true
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

_, ok := avail[controller]
return ok

@@ -76,8 +76,8 @@ func (m *manager) Apply(pid int) error {
// - "runc create (rootless + limits + no cgrouppath + no permission) fails with informative error"
if m.rootless {
if m.config.Path == "" {
cl, clErr := neededControllers(m.config)
if clErr == nil && len(cl) == 0 {
cl, clErr := needAnyControllers(m.config)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: cl used to mean "controller list". Now it's not so maybe rename to need or something.

ditto for clErr.

1. Partially revert "CreateCgroupPath: only enable needed controllers"
If we update a resource which did not limited in the beginning,
it will have no effective.
2. Returns err if we use an non enabled controller,
or else the user may feel success, but actually there are no effective.

Signed-off-by: lifubang <[email protected]>
@kolyshkin
Copy link
Contributor

kolyshkin commented May 23, 2020

LGTM

@mrunalp @AkihiroSuda PTAL

Approved with PullApprove

@AkihiroSuda
Copy link
Member

AkihiroSuda commented May 25, 2020

LGTM

Approved with PullApprove

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

runc update broken in cgroup v2
3 participants