Re: [PATCH net-next 2/6] selftests: net: lib: remove ns from list after clean-up

From: Simon Horman
Date: Fri Jun 14 2024 - 06:40:21 EST


On Fri, Jun 07, 2024 at 06:31:03PM +0200, Matthieu Baerts (NGI0) wrote:
> Instead of only appending items to the list, removing them when the
> netns has been deleted.
>
> By doing that, we can make sure 'cleanup_all_ns()' is not trying to
> remove already deleted netns.
>
> Reviewed-by: Geliang Tang <geliang@xxxxxxxxxx>
> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@xxxxxxxxxx>

Hi Matthieu,

I like this, and I am happy to see that it has been accepted.

I do wonder if we can go a step further and use an associative array for
ns_list (maybe renamed). I think this would reduce remove_ns_list to
something like:

unset ns_list["$item"]

OTOH, perhaps this breaks with older versions of bash that we still
care about.

...