[Devel] Re: [PATCH 10/12] L2 network namespace: playing with pass-through device

Cedric Le Goater clg at fr.ibm.com
Mon Dec 11 07:35:14 PST 2006


>  void free_net_ns(struct kref *kref)
>  {
>  	struct net_namespace *ns;
> +	unsigned long flags;
>  
> +	/* taking lock after atomic_dec_and_test is racy */
> +	spin_lock_irqsave(&net_ns_list_lock, flags);
>  	ns = container_of(kref, struct net_namespace, kref);
> +	if (atomic_read(&ns->kref.refcount) ||
> +	    list_empty(&ns->sibling_list)) {
> +		spin_unlock_irqrestore(&net_ns_list_lock, flags);
> +		return;

what about the cleanup ? is it skipped ?
 
> +	}
> +	list_del_init(&ns->sibling_list);
> +	spin_unlock_irqrestore(&net_ns_list_lock, flags);
> +	put_net_ns(ns->parent);
> +
>  	unregister_netdev(ns->loopback_dev_p);
>  	if (ns->dev_base_p != NULL) {
>  		printk("NET_NS: BUG: namespace %p has devices! ref %d\n",
> @@ -104,8 +128,10 @@ void free_net_ns(struct kref *kref)
>  		return;
>  	}
>  	ip_fib_struct_cleanup();
> +	printk(KERN_DEBUG "NET_NS: net namespace %p (%u) destroyed\n",
> +			ns, ns->id);
>  	kfree(ns);
>  }
> +/* because of put_net_ns() */
>  EXPORT_SYMBOL(free_net_ns);
> -
>  #endif /* CONFIG_NET_NS */
_______________________________________________
Containers mailing list
Containers at lists.osdl.org
https://lists.osdl.org/mailman/listinfo/containers




More information about the Devel mailing list