[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEKGpzjXUhnOVbamcysTX7KOrmEZ_JEzZMah3f9sLM2h+OkXsQ@mail.gmail.com>
Date: Wed, 18 Nov 2020 18:03:14 +0900
From: "Daniel T. Lee" <danieltimlee@...il.com>
To: Martin KaFai Lau <kafai@...com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
Andrii Nakryiko <andrii@...nel.org>, brakmo <brakmo@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Andrii Nakryiko <andrii.nakryiko@...il.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
David Ahern <dsa@...ulusnetworks.com>,
Yonghong Song <yhs@...com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Ira Weiny <ira.weiny@...el.com>, Thomas Graf <tgraf@...g.ch>,
Jakub Kicinski <kuba@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
bpf <bpf@...r.kernel.org>, netdev <netdev@...r.kernel.org>,
Xdp <xdp-newbies@...r.kernel.org>
Subject: Re: [PATCH bpf-next 3/9] samples: bpf: refactor test_cgrp2_sock2
program with libbpf
On Wed, Nov 18, 2020 at 2:58 PM Martin KaFai Lau <kafai@...com> wrote:
>
> On Tue, Nov 17, 2020 at 02:56:38PM +0000, Daniel T. Lee wrote:
> [ ... ]
>
> > + err = bpf_link__pin(link, link_pin_path);
> > + if (err < 0) {
> > + printf("err : %d\n", err);
> > + goto cleanup;
> > + }
> > +
> > + ret = EXIT_SUCCESS;
> > +
> > +cleanup:
> > + if (ret != EXIT_SUCCESS)
> > + bpf_link__destroy(link);
> This looks wrong. cleanup should be done regardless.
>
At first, I thought destroying the link after the link__pin might unpin
the link, but I just tested it and confirmed that it actually didn't
and that the link kept pinned.
Thanks for pointing it out! I will stick to this method.
> > +
> > + bpf_object__close(obj);
> > + return ret;
> > }
--
Best,
Daniel T. Lee
Powered by blists - more mailing lists