Thread (3 messages) read the whole thread 3 messages, 2 authors, 2013-01-16

Re: [RFC(v2) net-next 01/13] ndisc: Refer/Update neigh->updated with write lock.

From: YOSHIFUJI Hideaki <hidden>
Date: 2013-01-16 14:04:40

Cong Wang wrote:
On 01/16/2013 12:44 AM, YOSHIFUJI Hideaki wrote:
quoted
Signed-off-by: YOSHIFUJI Hideaki <redacted>
---
  net/ipv6/route.c |   12 ++++++++----
  1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7c34c01..1341f68 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -499,22 +499,26 @@ static void rt6_probe(struct rt6_info *rt)
  	 * to no more than one per minute.
  	 */
  	neigh = rt ? rt->n : NULL;
-	if (!neigh || (neigh->nud_state & NUD_VALID))
+	if (!neigh)
+		return;
+	write_lock_bh(&neigh->lock);
+	if (neigh->nud_state & NUD_VALID) {
+		write_unlock_bh(&neigh->lock);
  		return;
-	read_lock_bh(&neigh->lock);
+	}
  	if (!(neigh->nud_state & NUD_VALID) &&
  	    time_after(jiffies, neigh->updated + rt->rt6i_idev->cnf.rtr_probe_interval)) {
  		struct in6_addr mcaddr;
  		struct in6_addr *target;
  
  		neigh->updated = jiffies;
-		read_unlock_bh(&neigh->lock);
+		write_unlock_bh(&neigh->lock);
This looks like a bug fix, which deserves a separated patch rather than
in this rt->n removal series.
Because the series depends on this, it is included here so far.

--yoshfuji
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help