Skip to content

fs2: reset cgroup.freeze to thawed when freezing fails#62

Open
yugstar wants to merge 1 commit into
opencontainers:mainfrom
yugstar:fix-5325-freezer-reset-on-timeout
Open

fs2: reset cgroup.freeze to thawed when freezing fails#62
yugstar wants to merge 1 commit into
opencontainers:mainfrom
yugstar:fix-5325-freezer-reset-on-timeout

Conversation

@yugstar

@yugstar yugstar commented Jun 18, 2026

Copy link
Copy Markdown

Fixes opencontainers/runc#5325

When freezing a cgroup v2 fails after the freeze has been requested — for example the freeze times out (waitFrozen) or the confirmed state does not match — setFreezer returned the error but left cgroup.freeze set to 1, leaving the cgroup in a half-frozen state.

This resets cgroup.freeze back to 0 (thawed) on the freeze error path via a deferred best-effort write (the original error is preserved). It mirrors the existing cgroup v1 behaviour added in runc#2774, where fs/freezer.go thaws on failure.

@yugstar yugstar requested a review from a team as a code owner June 18, 2026 19:34
@yugstar yugstar force-pushed the fix-5325-freezer-reset-on-timeout branch from f60040c to 85974cc Compare June 18, 2026 19:35
Comment thread fs2/freezer.go Outdated
)

func setFreezer(dirPath string, state cgroups.FreezerState) error {
func setFreezer(dirPath string, state cgroups.FreezerState) (Err error) {

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.

we typically use retErr

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, switched the named return to retErr.

When freezing a cgroup v2 fails after the freeze was requested (for
example the freeze times out, or the confirmed state does not match),
setFreezer returned the error but left cgroup.freeze set to "1", leaving
the cgroup in a half-frozen state. Reset it back to "0" (thawed) on the
freeze error path via a best-effort deferred write, mirroring the cgroup
v1 behaviour from runc#2774.

Fixes opencontainers/runc#5325

Signed-off-by: Aman Raj <aman.yug@gmail.com>
@yugstar yugstar force-pushed the fix-5325-freezer-reset-on-timeout branch from 85974cc to 424b9d9 Compare June 19, 2026 14:04
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.

fs2/freezer: cgroup.freeze is not reset on freeze timeout (unlike cgroup v1)

2 participants