From: Jesse Gross <jesse@nicira.com>
Date: Sat, 25 Dec 2010 03:16:20 +0000 (-0800)
Subject: tunnel: Drop spinlock around cache free.
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c150f6a7039218080e067e9955aac0f6a55a712;p=openvswitch

tunnel: Drop spinlock around cache free.

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>
---

diff --git a/datapath/tunnel.c b/datapath/tunnel.c
index ce1d8eb5..ee9e45d3 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));
 }