[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4d438cdf-7e16-4a75-b2ca-d3dea6f1c045@bootlin.com>
Date: Sat, 19 Oct 2024 14:13:54 +0200
From: Alexis Lothoré <alexis.lothore@...tlin.com>
To: Martin KaFai Lau <martin.lau@...ux.dev>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Mykola Lysenko <mykolal@...com>,
Shuah Khan <shuah@...nel.org>, "David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Jesper Dangaard Brouer <hawk@...nel.org>,
ebpf@...uxfoundation.org, Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Lorenz Bauer <lmb@...udflare.com>, bpf@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH bpf-next 2/6] selftests/bpf: add missing ns cleanups in
btf_skc_cls_ingress
Hi Martin, thanks for the review !
On 10/19/24 01:57, Martin KaFai Lau wrote:
> On 10/16/24 11:35 AM, Alexis Lothoré (eBPF Foundation) wrote:
>> btf_skc_cls_ingress.c currently runs two subtests, and create a
>> dedicated network namespace for each, but never cleans up the created
>> namespace once the test has ended.
>>
>> Add missing namespace cleanup after each namespace to avoid accumulating
>> namespaces for each new subtest. While at it, switch namespace
>> management to netns_{new,free}
>>
>> Signed-off-by: Alexis Lothoré (eBPF Foundation) <alexis.lothore@...tlin.com>
[...]
>> - if (CHECK(unshare(CLONE_NEWNET), "create netns",
>> - "unshare(CLONE_NEWNET): %s (%d)",
>> - strerror(errno), errno))
>> - return -1;
>> + ns = netns_new(TEST_NS, true);
>> + if (!ASSERT_OK_PTR(ns, "create and join netns"))
>> + return ns;
>> if (CHECK(system("ip link set dev lo up"),
>> "ip link set dev lo up", "failed\n"))
>
> nit. netns_new() takes care of "lo up" also, so the above can be removed.
Ah, indeed, I missed it in make_netns. Thanks, I'll remove this part from the
test then.
>
> test_progs.c has restore_netns() after each test, so the netns was not cleaned
> up. The second unshare should have freed the earlier netns also.
>
> Using netns_new() removed the boiler plate codes. It is nice to see this change
> here regardless.
--
Alexis Lothoré, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists