Skip to content

cgroup: explain a rejected cpuset fence write instead of surfacing bare ENOSPC - #192

Merged
CMGS merged 1 commit into
masterfrom
fix/cgroup-fence-live-scopes
Aug 9, 2026
Merged

cgroup: explain a rejected cpuset fence write instead of surfacing bare ENOSPC#192
CMGS merged 1 commit into
masterfrom
fix/cgroup-fence-live-scopes

Conversation

@CMGS

@CMGS CMGS commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Changing cgroup_cpus while VM scopes are live makes the kernel reject the cpuset.cpus write with ENOSPC. What the operator sees is:

Error: clone VM: launch CH: prepare cgroup scope:
       write /sys/fs/cgroup/cocoon.slice/cpuset.cpus: no space left on device

That points at the disk, not at the fence. Hit while benchmarking a 120-VM Windows fleet; it cost about half an hour to trace, and the first hypothesis was a cocoon bug rather than an operator error.

checkScopePlacements does not catch this: it only inspects scopes that carry an explicit cpuset.cpus, and skips inheriting ones — which are the common case, since most fleets never set a per-VM placement. The clear-fence branch (fence == "") had no check at all, and that is the path that failed.

This wraps the write error with the current fence, the requested one, and the number of running VMs:

cgroup_cpus "0-24" -> "" rejected with 29 VM(s) running;
the fence is machine-wide, drain them first: ... no space left on device

Deliberately an annotation rather than a pre-flight refusal: narrowing the fence did succeed on a live fleet in the same session, so refusing every change while scopes exist would regress a path that works today. The wrap only fires when the kernel has already said no.

make lint clean on both GOOS, asl ./... clean on both, go test ./cgroup/... green.

…re ENOSPC

Changing cgroup_cpus while VM scopes are live makes the kernel reject the
cpuset write with ENOSPC. That reaches the operator as "vm clone: prepare
cgroup scope: no space left on device", which points at disk rather than at
the fence, and checkScopePlacements does not catch it: it only inspects
scopes carrying an explicit placement, while inheriting scopes are the
common case. The clear-fence path had no check at all.

Wrap the write error with the current fence, the requested one and the
number of running VMs so the message says what to do.
@CMGS
CMGS merged commit 47e08dd into master Aug 9, 2026
4 checks passed
@CMGS
CMGS deleted the fix/cgroup-fence-live-scopes branch August 9, 2026 13:52
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.

1 participant