netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daan De Meyer <daan.j.demeyer@gmail.com>
To: bpf@vger.kernel.org
Cc: Daan De Meyer <daan.j.demeyer@gmail.com>,
	martin.lau@linux.dev, kernel-team@meta.com,
	netdev@vger.kernel.org
Subject: [PATCH bpf-next v6 8/9] selftests/bpf: Make sure mount directory exists
Date: Tue, 26 Sep 2023 22:27:47 +0200	[thread overview]
Message-ID: <20230926202753.1482200-9-daan.j.demeyer@gmail.com> (raw)
In-Reply-To: <20230926202753.1482200-1-daan.j.demeyer@gmail.com>

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>
---
 tools/testing/selftests/bpf/cgroup_helpers.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/bpf/cgroup_helpers.c b/tools/testing/selftests/bpf/cgroup_helpers.c
index 2caee8423ee0..6dcf0cd375c4 100644
--- a/tools/testing/selftests/bpf/cgroup_helpers.c
+++ b/tools/testing/selftests/bpf/cgroup_helpers.c
@@ -195,6 +195,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;
-- 
2.41.0


  parent reply	other threads:[~2023-09-26 20:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 20:27 [PATCH bpf-next v6 0/9] Add cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-09-26 20:27 ` [PATCH bpf-next v6 1/9] selftests/bpf: Add missing section name tests for getpeername/getsockname Daan De Meyer
2023-09-26 20:27 ` [PATCH bpf-next v6 2/9] bpf: Propagate modified uaddrlen from cgroup sockaddr programs Daan De Meyer
2023-09-27 22:19   ` Martin KaFai Lau
2023-09-26 20:27 ` [PATCH bpf-next v6 3/9] bpf: Add bpf_sock_addr_set_unix_addr() to allow writing unix sockaddr from bpf Daan De Meyer
2023-09-26 20:27 ` [PATCH bpf-next v6 4/9] bpf: Implement cgroup sockaddr hooks for unix sockets Daan De Meyer
2023-09-27 22:32   ` Martin KaFai Lau
2023-09-26 20:27 ` [PATCH bpf-next v6 5/9] libbpf: Add support for cgroup unix socket address hooks Daan De Meyer
2023-09-26 20:27 ` [PATCH bpf-next v6 6/9] bpftool: " Daan De Meyer
2023-09-27  8:26   ` Quentin Monnet
2023-09-26 20:27 ` [PATCH bpf-next v6 7/9] documentation/bpf: Document " Daan De Meyer
2023-09-26 20:27 ` Daan De Meyer [this message]
2023-09-26 20:27 ` [PATCH bpf-next v6 9/9] selftests/bpf: Add tests for " Daan De Meyer
2023-09-27 22:36   ` Martin KaFai Lau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230926202753.1482200-9-daan.j.demeyer@gmail.com \
    --to=daan.j.demeyer@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=kernel-team@meta.com \
    --cc=martin.lau@linux.dev \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).