Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

cgroups: fs: fix issues with .Apply() #652

Closed
wants to merge 1 commit into from
Closed

cgroups: fs: fix issues with .Apply() #652

wants to merge 1 commit into from

Conversation

cyphar
Copy link
Contributor

@cyphar cyphar commented Jun 25, 2015

If a configuration option is set for a cgroup that isn't mounted, an
error will be emitted. This is an issue, because newer cgroups aren't
present in older kernels, and we can't break backcompat where a new
config can't run on an older kernel.

The issue arises because .Set() does no checks for whether the given
path actually points to a mountpoint, so fix the code by just bailing if
the cgroup mountpoint doesn't exist.

Fixes: fc3981e
Fixes: 606d906
Signed-off-by: Aleksa Sarai cyphar@cyphar.com

This was already done in 606d906, and then reverted in fc3981e. I could not find a related PR to explain why the reversion was done, but this is an issue I'm facing when testing a new cgroup/fs I'm writing, where the kernel doesn't support it but the config is also non-default.

If a configuration option is set for a cgroup that isn't mounted, an
error will be emitted. This is an issue, because newer cgroups aren't
present in older kernels, and we can't break backcompat where a new
config can't run on an older kernel.

The issue arises because .Set() does no checks for whether the given
path actually points to a mountpoint, so fix the code by just bailing if
the cgroup mountpoint doesn't exist.

Fixes: fc3981e
Fixes: 606d906
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
@cyphar
Copy link
Contributor Author

cyphar commented Jun 25, 2015

I found the relevant PR #474. However, I don't agree that we should fail if we have a configuration option that applies to a cgroup which the host kernel doesn't support and also isn't a hard requirement. As it currently stands, the cgroup.IsNotFound(err) check is essentially a no-op as we fail in .Set() anyway. The only time it is actually useful is where the cgroup has no options to set -- which is just a side-effect of .Set() doing nothing.

@cyphar
Copy link
Contributor Author

cyphar commented Jun 25, 2015

/cc @crosbymichael

@hqhq
Copy link
Contributor

hqhq commented Jun 29, 2015

I don't quite understand the problem here, can't #476 fix your problem?

@hqhq
Copy link
Contributor

hqhq commented Jun 29, 2015

The logic is:

  • If a cgroup subsystem is not mounted, do not fail by default.
  • If a cgroup subsystem is not mounted (or not supported), and user assigned a related option, we fail.

@cyphar
Copy link
Contributor Author

cyphar commented Jun 29, 2015

The point was that the fact we fail on options set on non-existant cgroups didn't really make sense to me. But really, I don't like the idea of us silently ignoring the config. I'll close this PR.

@cyphar cyphar closed this Jun 29, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants