[ovs-dev] [PATCH 06/10] tunnel: Drop spinlock around cache free.

Jesse Gross jesse at nicira.com
Wed Dec 29 04:50:44 UTC 2010


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 at nicira.com>
---
 datapath/tunnel.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index ce1d8eb..ee9e45d 100644
--- a/datapath/tunnel.c
+++ b/datapath/tunnel.c
@@ -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));
 }
-- 
1.7.1





More information about the dev mailing list