Hi Krisztián,

On Tue, Sep 24, 2019 at 12:18:51PM +0000, Krisztián Kovács (kkovacs) wrote:
> When doing a soft shutdown, we won't be making new connections anymore so
> there's no point in keeping the namespace file descriptors open anymore.
> 

This does make sense. However I'm having two very minor style comments:

>  /* Opens the namespace <ns_name> and returns the FD or -1 in case of error
> @@ -39,6 +40,24 @@ static int init_default_namespace()
>  
>  static struct eb_root namespace_tree_root = EB_ROOT;
>  
> +static void netns_sig_stop(struct sig_handler *sh) {
                                                      ^
This brace should be on the left at the begginning of next line here:
{
> +     struct ebpt_node *node, *next;
> +     struct netns_entry *entry;

(...)
> +
> +     /* close namespace file descriptors and remove registered namespaces 
> from the
> +      * tree when stopping */
> +     node = ebpt_first(&namespace_tree_root);
> +     while (node) {
> +             next = ebpt_next(node);
> +             ebpt_delete(node);
> +             entry = container_of(node, struct netns_entry, node);
> +             ha_warning("Closing namespace %s.\n", (char *)entry->node.key);

Please do not emit warnings here. Warnings are exclusively to warn users
about things they *can* fix. Here there is nothing they can do about this
one and it ends up in users sending them to /dev/null and not seeing the
important ones.

> @@ -55,6 +74,8 @@ int netns_init(void)
>               }
>       }
>  
> +  signal_register_fct(0, netns_sig_stop, 0);
> +
>       return err_code;

Warning indent issue above, you seem to have used two spaces instead
of the tab used in other lines around.

And that's all, as you see it was really minor.

Thanks,
Willy

Reply via email to