[PATCH 1/8 net-2.6.26] [NETNS]: Make netns refconting debug like a socket one.

Brian Haley brian.haley at hp.com
Tue Apr 15 07:55:20 PDT 2008


Denis V. Lunev wrote:
> +#ifdef NETNS_REFCNT_DEBUG
>  static inline struct net *hold_net(struct net *net)
>  {
> +	if (net == NULL)
> +		return NULL;
> +	atomic_inc(&net->use_count);
>  	return net;
>  }

This could be shrunk to:

	if (net)
		atomic_inc(&net->use_count);
	return net;

>  static inline void release_net(struct net *net)
>  {
> +	if (net == NULL)
> +		return;
> +	atomic_dec(&net->use_count);
>  }

This one too:

	if (net)
		atomic_dec(&net->use_count);

-Brian


More information about the Containers mailing list