mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
bpftool: Mount bpffs when pinmaps path not under the bpffs
[ Upstream commit da5f8fd1f0d393d5eaaba9ad8c22d1c26bb2bf9b ]
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] https://github.com/libbpf/bpftool/issues/146
Fixes: 3767a94b32
("bpftool: add pinmaps argument to the load/loadall")
Signed-off-by: Tao Chen <chen.dylane@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Quentin Monnet <qmo@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/20240702131150.15622-1-chen.dylane@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
878c90b54b
commit
77bf25dab8
1 changed files with 4 additions and 0 deletions
|
@ -1809,6 +1809,10 @@ offload_dev:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pinmaps) {
|
if (pinmaps) {
|
||||||
|
err = create_and_mount_bpffs_dir(pinmaps);
|
||||||
|
if (err)
|
||||||
|
goto err_unpin;
|
||||||
|
|
||||||
err = bpf_object__pin_maps(obj, pinmaps);
|
err = bpf_object__pin_maps(obj, pinmaps);
|
||||||
if (err) {
|
if (err) {
|
||||||
p_err("failed to pin all maps");
|
p_err("failed to pin all maps");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue