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

Handle case where cgroup v1 freezer is disabled #1616

Merged
merged 1 commit into from
Dec 6, 2024

Conversation

michalsieron
Copy link
Contributor

On cgroup v1 it is possible to disable freezer subsystem. In such case freezer.state file won't be present. Due to the race condition handling in libcrun_get_container_state_string, missing freezer.state would be interpreted as cgroup being removed when check is being performed.

But as indicated earlier, that is not the case when it's cgroup v1 and the freezer is disabled. Therefore introduce logic that checks for that using type of the filesystem mounted under the freezer directory.

When freezer is disabled, container simply cannot be paused.

Fixes #1612

@michalsieron michalsieron force-pushed the no-cgroup-v1-freezer branch 2 times, most recently from e2b4c89 to 186ec99 Compare December 6, 2024 09:26
@kwilczynski
Copy link
Member

Nice.

@kwilczynski
Copy link
Member

/approve
/lgtm

src/libcrun/cgroup.c Outdated Show resolved Hide resolved
On cgroup v1 it is possible to disable freezer subsystem. In such case
freezer.state file won't be present. Due to the race condition handling
in libcrun_get_container_state_string, missing freezer.state would be
interpreted as cgroup being removed when check is being performed.

But as indicated earlier, that is not the case when it's cgroup v1 and
the freezer is disabled. Therefore introduce logic that checks for that
using type of the filesystem mounted under the freezer directory.

When freezer is disabled, container simply cannot be paused.

Fixes containers#1612

Signed-off-by: Michal Sieron <michalwsieron@gmail.com>
Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

I'll merge once the CI is green

@giuseppe giuseppe merged commit 1aac2ef into containers:main Dec 6, 2024
53 checks passed
@michalsieron michalsieron deleted the no-cgroup-v1-freezer branch December 6, 2024 14:58
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.

Running container is reported as stopped when cgroup v1 is used and freezer is disabled
3 participants