[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzbfpZBStaQoBr-Zdsb8RAF4f5sGEj7aWr+yLB+Hdbq3jA@mail.gmail.com>
Date: Mon, 5 Oct 2020 14:22:49 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
Networking <netdev@...r.kernel.org>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCHv2 bpf 2/3] libbpf: check if pin_path was set even map fd exist
On Sat, Oct 3, 2020 at 1:55 AM Hangbin Liu <liuhangbin@...il.com> wrote:
>
> Say a user reuse map fd after creating a map manually and set the
> pin_path, then load the object via libbpf.
>
> In libbpf bpf_object__create_maps(), bpf_object__reuse_map() will
> return 0 if there is no pinned map in map->pin_path. Then after
> checking if map fd exist, we should also check if pin_path was set
> and do bpf_map__pin() instead of continue the loop.
>
> Fix it by creating map if fd not exist and continue checking pin_path
> after that.
>
> v2: keep if condition with existing order
>
> Suggested-by: Andrii Nakryiko <andrii.nakryiko@...il.com>
> Signed-off-by: Hangbin Liu <liuhangbin@...il.com>
> ---
Acked-by: Andrii Nakryiko <andrii@...nel.org>
> tools/lib/bpf/libbpf.c | 37 ++++++++++++++++++-------------------
> 1 file changed, 18 insertions(+), 19 deletions(-)
>
[...]
Powered by blists - more mailing lists