Skip to content

Conversation

@Berbe
Copy link

@Berbe Berbe commented Nov 29, 2025

Load does not check for cgroup existence: this proposal fixes this

@Berbe Berbe force-pushed the fix/cgroup2/load branch 3 times, most recently from 59fb1f1 to f122353 Compare November 29, 2025 15:47
return nil, err
}
path := filepath.Join(c.mountpoint, group)
_, err := os.Stat(path)
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure we should check this. It's just loading into object.
All the operations doesn't hold fd for this path. It could be valid case that Load it first and create it later.

ping @AkihiroSuda @mikebrow @dmcgowan to review this.

Copy link
Member

@dcantah dcantah Jan 15, 2026

Choose a reason for hiding this comment

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

I would, maybe naively, expect a function named Load to verify what we were trying to load is valid, and that's how I'd envision the API would be used (try to load an existing cgroup, and if it's not there I'd want to get some classic stdlib error to handle the not existing case). We could discuss whether Stat is a good enough metric for proving it's valid as well (e.g. maybe we want to actually see whether the path is a path in a cg2 mountpoint), but that's another topic. The API for creating and getting a handle to a cg2 in this library is NewManager(), and the only other way to create a new cg through the API is manager.NewChild(), but the expectation is you'd be creating a child cg from the one you already have a handle to.

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.

3 participants