kernel/cgroup: use kernfs_create_dir_ns()
authorMax Kellermann <max.kellermann@ionos.com>
Fri, 8 Dec 2023 09:33:09 +0000 (10:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Dec 2023 16:22:40 +0000 (17:22 +0100)
commitfe3de0102bc830e78d80dbf6e2dd29c520d68575
treefd1edfbf38c013c5a70cfe79947e89d3a744791d
parent7c23fb2e6e3b40db5abbead64842060f13c4bb15
kernel/cgroup: use kernfs_create_dir_ns()

By passing the fsugid to kernfs_create_dir_ns(), we don't need
cgroup_kn_set_ugid() any longer.  That function was added for exactly
this purpose by commit 49957f8e2a43 ("cgroup: newly created dirs and
files should be owned by the creator").

Eliminating this piece of duplicate code means we benefit from future
improvements to kernfs_create_dir_ns(); for example, both are lacking
S_ISGID support currently, which my next patch will add to
kernfs_create_dir_ns().  It cannot (easily) be added to
cgroup_kn_set_ugid() because we can't dereference struct kernfs_iattrs
from there.

--
v1 -> v2: 12-digit commit id

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20231208093310.297233-1-max.kellermann@ionos.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/cgroup/cgroup.c