bpftool: Support bpffs mountpoint as pin path for prog loadall

Currently, when using prog loadall and the pin path is a bpffs mountpoint,
bpffs will be repeatedly mounted to the parent directory of the bpffs
mountpoint path. For example, a `bpftool prog loadall test.o /sys/fs/bpf`
will trigger this.

Signed-off-by: Pengcheng Yang <yangpc@wangsu.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/1683342439-3677-1-git-send-email-yangpc@wangsu.com
This commit is contained in:
Pengcheng Yang
2023-05-06 11:07:19 +08:00
committed by Daniel Borkmann
parent f04a32b2c5
commit 2a36c26fe3
5 changed files with 10 additions and 7 deletions

View File

@@ -1739,7 +1739,7 @@ static int load_with_options(int argc, char **argv, bool first_prog_only)
goto err_close_obj;
}
err = mount_bpffs_for_pin(pinfile);
err = mount_bpffs_for_pin(pinfile, !first_prog_only);
if (err)
goto err_close_obj;