[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201006021345.3817033-1-liuhangbin@gmail.com>
Date: Tue, 6 Oct 2020 10:13:42 +0800
From: Hangbin Liu <liuhangbin@...il.com>
To: bpf@...r.kernel.org
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
netdev@...r.kernel.org,
Toke Høiland-Jørgensen <toke@...hat.com>,
Hangbin Liu <liuhangbin@...il.com>
Subject: [PATCHv3 bpf 0/3] Fix pining maps after reuse map fd
When a user reuse map fd after creating a map manually and set the
pin_path, then load the object via libbpf. bpf_object__create_maps()
will skip pinning map if map fd exist. Fix it by add moving bpf creation
to else condition and go on checking map pin_path after that.
v3:
for selftest: use CHECK() for bpf_object__open_file() and close map fd on error
v2:
a) close map fd if init map slots failed
b) add bpf selftest for this scenario
Hangbin Liu (3):
libbpf: close map fd if init map slots failed
libbpf: check if pin_path was set even map fd exist
selftest/bpf: test pinning map with reused map fd
tools/lib/bpf/libbpf.c | 80 +++++++++++--------
.../selftests/bpf/prog_tests/pinning.c | 49 +++++++++++-
2 files changed, 94 insertions(+), 35 deletions(-)
--
2.25.4
Powered by blists - more mailing lists