veth: Do a better job cleaning up on rmmod
authorJustin Pettit <jpettit@nicira.com>
Wed, 21 Apr 2010 05:46:04 +0000 (22:46 -0700)
committerJustin Pettit <jpettit@nicira.com>
Thu, 22 Apr 2010 10:37:49 +0000 (03:37 -0700)
The veth driver doesn't clean itself up very well when removed.  This
commit destroys any outstanding veth devices and then unregisters its
sysfs entry.

datapath/linux-2.6/compat-2.6/veth.c

index 66aae0b9387cffff596a169fab489459ac80ea57..26d8dd91a46d6d3023faeb8aedf2b33cae049b05 100644 (file)
@@ -526,7 +526,17 @@ static __init int veth_init(void)
 
 static __exit void veth_exit(void)
 {
+       struct veth_priv *p, *n;
+
+       rtnl_lock();
+
+       list_for_each_entry_safe(p, n, &veth_list, list)
+               veth_dellink(p->dev);
+
+       rtnl_unlock();
+
        unregister_netdevice_notifier(&veth_notifier_block);
+       veth_destroy_sysfs();
 }
 
 module_init(veth_init);