cgroup: Disallow mounting v1 hierarchies without controller implementation
authorMichal Koutný <mkoutny@suse.com>
Mon, 9 Sep 2024 16:32:22 +0000 (18:32 +0200)
committerTejun Heo <tj@kernel.org>
Tue, 10 Sep 2024 20:03:43 +0000 (10:03 -1000)
commit3c41382e920f1dd5c9f432948fe799c07af1cced
tree0973009f5ecace4b8bc82b7c60c505e8f68995ac
parent659f90f863a628c007c49aff97b30cb5908a0480
cgroup: Disallow mounting v1 hierarchies without controller implementation

The configs that disable some v1 controllers would still allow mounting
them but with no controller-specific files. (Making such hierarchies
equivalent to named v1 hierarchies.) To achieve behavior consistent with
actual out-compilation of a whole controller, the mounts should treat
respective controllers as non-existent.

Wrap implementation into a helper function, leverage legacy_files to
detect compiled out controllers. The effect is that mounts on v1 would
fail and produce a message like:
  [ 1543.999081] cgroup: Unknown subsys name 'memory'

Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cgroup-v1.c