tunnel: Drop spinlock around cache free.
authorJesse Gross <jesse@nicira.com>
Sat, 25 Dec 2010 03:16:20 +0000 (19:16 -0800)
committerJesse Gross <jesse@nicira.com>
Wed, 29 Dec 2010 18:30:09 +0000 (10:30 -0800)
We hold a spinlock when freeing the cache, since you're generally
supposed to do that when writing to RCU protected data.  However,
there's really no point in doing that here because the port has
already been removed from both the transmit and receive side
data structures and we've waited for an RCU grace period.  In
addition, we're about to free the port itself, which contains the
spinlock and will be in trouble if anyone else is trying to
access it.  For clarity, drop the spinlock.

Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/tunnel.c

index ce1d8eb..ee9e45d 100644 (file)
@@ -1458,10 +1458,7 @@ static void free_port_rcu(struct rcu_head *rcu)
 {
        struct tnl_vport *tnl_vport = container_of(rcu, struct tnl_vport, rcu);
 
-       spin_lock_bh(&tnl_vport->cache_lock);
        free_cache(tnl_vport->cache);
-       spin_unlock_bh(&tnl_vport->cache_lock);
-
        kfree(tnl_vport->mutable);
        vport_free(tnl_vport_to_vport(tnl_vport));
 }