Skip to content

Commit 77bf25d

Browse files
chentao-kernelgregkh
authored andcommittedAug 3, 2024
bpftool: Mount bpffs when pinmaps path not under the bpffs
[ Upstream commit da5f8fd ] As Quentin said [0], BPF map pinning will fail if the pinmaps path is 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 [0] libbpf/bpftool#146 Fixes: 3767a94 ("bpftool: add pinmaps argument to the load/loadall") Signed-off-by: Tao Chen <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Quentin Monnet <[email protected]> Reviewed-by: Quentin Monnet <[email protected]> Link: https://lore.kernel.org/bpf/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent 878c90b commit 77bf25d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎tools/bpf/bpftool/prog.c

+4
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,10 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
18091809
}
18101810

18111811
if (pinmaps) {
1812+
err = create_and_mount_bpffs_dir(pinmaps);
1813+
if (err)
1814+
goto err_unpin;
1815+
18121816
err = bpf_object__pin_maps(obj, pinmaps);
18131817
if (err) {
18141818
p_err("failed to pin all maps");

0 commit comments

Comments
 (0)
Please sign in to comment.