Skip to content

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

Merged
AkihiroSuda merged 2 commits into
opencontainers:masterfrom
lifubang:updateCgroupv2
May 25, 2020
Merged

Partially revert "CreateCgroupPath: only enable needed controllers"#2395
AkihiroSuda merged 2 commits into
opencontainers:masterfrom
lifubang:updateCgroupv2

Conversation

@lifubang
Copy link
Copy Markdown
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 lifubang@acmcoder.com

Comment thread libcontainer/cgroups/fs2/fs2.go
@lifubang
Copy link
Copy Markdown
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.

Comment thread libcontainer/cgroups/fs2/memory.go
@lifubang lifubang marked this pull request as draft May 10, 2020 23:18
@lifubang
Copy link
Copy Markdown
Member Author

Waiting for #2390 complete.

Comment thread libcontainer/cgroups/fs2/create.go Outdated
@kolyshkin
Copy link
Copy Markdown
Contributor

@lifubang #2390 is now merged

@lifubang lifubang marked this pull request as ready for review May 13, 2020 23:08
Comment thread libcontainer/cgroups/fs2/create.go Outdated
Comment thread libcontainer/cgroups/fs2/create.go Outdated
}
var errs []error
// pids (since kernel 4.5)
if _, ok := m.controllers["pids"]; ok {
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member Author

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

Comment thread libcontainer/cgroups/fs2/create.go Outdated
@AkihiroSuda
Copy link
Copy Markdown
Member

AkihiroSuda commented May 20, 2020

LGTM, can we also have tests?

Approved with PullApprove

@lifubang
Copy link
Copy Markdown
Member Author

LGTM, can we also have tests?

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

Comment thread tests/integration/cgroups.bats Outdated
Comment thread tests/integration/cgroups.bats Outdated
@lifubang lifubang force-pushed the updateCgroupv2 branch 2 times, most recently from 9e4e363 to 1ed174f Compare May 20, 2020 16:18
@AkihiroSuda
Copy link
Copy Markdown
Member

AkihiroSuda commented May 20, 2020

LGTM (if green)

Approved with PullApprove

Comment thread libcontainer/cgroups/fs2/create.go Outdated
if _, ok := avail[controller]; ok {
list = append(list, "+"+controller)
return true
}
Copy link
Copy Markdown
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

Comment thread libcontainer/cgroups/fs2/fs2.go Outdated
if m.config.Path == "" {
cl, clErr := neededControllers(m.config)
if clErr == nil && len(cl) == 0 {
cl, clErr := needAnyControllers(m.config)
Copy link
Copy Markdown
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.

Comment thread tests/integration/cgroups.bats
lifubang added 2 commits May 21, 2020 12:17
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 <lifubang@acmcoder.com>
Signed-off-by: lifubang <lifubang@acmcoder.com>
@kolyshkin
Copy link
Copy Markdown
Contributor

kolyshkin commented May 23, 2020

LGTM

@mrunalp @AkihiroSuda PTAL

Approved with PullApprove

@AkihiroSuda
Copy link
Copy Markdown
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