public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpftool: Mount bpffs when pinmaps path not under the bpffs
@ 2024-07-02 13:11 Tao Chen
  2024-07-02 16:05 ` Quentin Monnet
  2024-07-02 16:30 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Tao Chen @ 2024-07-02 13:11 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, bpf,
	Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	linux-kernel, chen.dylane

As qmonnet said [1], map pinning will fail if the pinmaps path not under
the bpffs, like:
libbpf: specified path /home/ubuntu/test/sock_ops_map is not on BPF FS
Error: failed to pin all maps
[1]: https://github.com/libbpf/bpftool/issues/146

Fixes: 3767a94b3253 ("bpftool: add pinmaps argument to the load/loadall")
Signed-off-by: Tao Chen <chen.dylane@gmail.com>
---
 tools/bpf/bpftool/prog.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 1a501cf09e78..40ea743d139f 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -1813,6 +1813,10 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
 	}
 
 	if (pinmaps) {
+		err = create_and_mount_bpffs_dir(pinmaps);
+		if (err)
+			goto err_unpin;
+
 		err = bpf_object__pin_maps(obj, pinmaps);
 		if (err) {
 			p_err("failed to pin all maps");
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpftool: Mount bpffs when pinmaps path not under the bpffs
  2024-07-02 13:11 [PATCH bpf-next] bpftool: Mount bpffs when pinmaps path not under the bpffs Tao Chen
@ 2024-07-02 16:05 ` Quentin Monnet
  2024-07-02 16:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Quentin Monnet @ 2024-07-02 16:05 UTC (permalink / raw)
  To: Tao Chen
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, bpf,
	Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
	linux-kernel

On 02/07/2024 14:11, Tao Chen wrote:
> As qmonnet said [1], map pinning will fail if the pinmaps path not under
> the bpffs, like:
> libbpf: specified path /home/ubuntu/test/sock_ops_map is not on BPF FS
> Error: failed to pin all maps
> [1]: https://github.com/libbpf/bpftool/issues/146
> 
> Fixes: 3767a94b3253 ("bpftool: add pinmaps argument to the load/loadall")
> Signed-off-by: Tao Chen <chen.dylane@gmail.com>

The patch looks good, thank you!

Tested-by: Quentin Monnet <qmo@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpftool: Mount bpffs when pinmaps path not under the bpffs
  2024-07-02 13:11 [PATCH bpf-next] bpftool: Mount bpffs when pinmaps path not under the bpffs Tao Chen
  2024-07-02 16:05 ` Quentin Monnet
@ 2024-07-02 16:30 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-07-02 16:30 UTC (permalink / raw)
  To: Tao Chen
  Cc: qmo, ast, daniel, andrii, bpf, martin.lau, eddyz87, song,
	yonghong.song, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Tue,  2 Jul 2024 21:11:50 +0800 you wrote:
> As qmonnet said [1], map pinning will fail if the pinmaps path not under
> the bpffs, like:
> libbpf: specified path /home/ubuntu/test/sock_ops_map is not on BPF FS
> Error: failed to pin all maps
> [1]: https://github.com/libbpf/bpftool/issues/146
> 
> Fixes: 3767a94b3253 ("bpftool: add pinmaps argument to the load/loadall")
> Signed-off-by: Tao Chen <chen.dylane@gmail.com>
> 
> [...]

Here is the summary with links:
  - [bpf-next] bpftool: Mount bpffs when pinmaps path not under the bpffs
    https://git.kernel.org/bpf/bpf-next/c/da5f8fd1f0d3

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-02 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02 13:11 [PATCH bpf-next] bpftool: Mount bpffs when pinmaps path not under the bpffs Tao Chen
2024-07-02 16:05 ` Quentin Monnet
2024-07-02 16:30 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox