diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2023-10-11 21:51:10 +0300 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2023-10-12 03:27:55 +0300 |
commit | af2752ed450e71fc0bd596d0b4b9b805a64ae2c1 (patch) | |
tree | 4bf1a4389986554336461f4c19d057bd791d6ecf /tools/testing/selftests/bpf/cgroup_helpers.c | |
parent | 3243fef6a4c0db2dbb01ee3cf30bd787e65b8d56 (diff) | |
download | linux-af2752ed450e71fc0bd596d0b4b9b805a64ae2c1.tar.xz |
selftests/bpf: Make sure mount directory exists
The mount directory for the selftests cgroup tree might
not exist so let's make sure it does exist by creating
it ourselves if it doesn't exist.
Signed-off-by: Daan De Meyer <daan.j.demeyer@gmail.com>
Link: https://lore.kernel.org/r/20231011185113.140426-9-daan.j.demeyer@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/cgroup_helpers.c')
-rw-r--r-- | tools/testing/selftests/bpf/cgroup_helpers.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c index 24ba56d42f2d..5b1da2a32ea7 100644 --- a/tools/testing/selftests/bpf/cgroup_helpers.c +++ b/tools/testing/selftests/bpf/cgroup_helpers.c @@ -199,6 +199,11 @@ int setup_cgroup_environment(void) format_cgroup_path(cgroup_workdir, ""); + if (mkdir(CGROUP_MOUNT_PATH, 0777) && errno != EEXIST) { + log_err("mkdir mount"); + return 1; + } + if (unshare(CLONE_NEWNS)) { log_err("unshare"); return 1; |