Don't try to destroy dp_dev while the local port holds a reference to it.
authorBen Pfaff <blp@nicira.com>
Mon, 2 Jun 2008 17:16:34 +0000 (10:16 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 3 Jun 2008 03:18:38 +0000 (20:18 -0700)
Fixes a message output at deldp time:
unregister_netdevice: waiting for of0 to become free. Usage count = 1

Thanks to Murphy and Justin for reporting this bug.

datapath/datapath.c

index c87fa241634e39f70108aa2195627949e4ac140a..adc698065ea873a1a9e4e03e669824421c128235 100644 (file)
@@ -408,7 +408,6 @@ static void del_dp(struct datapath *dp)
 {
        struct net_bridge_port *p;
 
-       dp_dev_destroy(dp);
        kthread_stop(dp->dp_task);
 
        /* Drop references to DP. */
@@ -416,6 +415,10 @@ static void del_dp(struct datapath *dp)
                del_switch_port(p);
        rcu_assign_pointer(dps[dp->dp_idx], NULL);
 
+       /* Destroy dp->netdev.  (Must follow deleting switch ports since
+        * dp->local_port has a reference to it.) */
+       dp_dev_destroy(dp);
+
        /* Wait until no longer in use, then destroy it. */
        synchronize_rcu();
        chain_destroy(dp->chain);