netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC(v2) net-next 01/13] ndisc: Refer/Update neigh->updated with write lock.
@ 2013-01-15 16:44 YOSHIFUJI Hideaki
  2013-01-16  6:35 ` Cong Wang
  0 siblings, 1 reply; 3+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-01-15 16:44 UTC (permalink / raw)
  To: netdev; +Cc: yoshfuji, xiyou.wangcong

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
---
 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);
 
 		target = (struct in6_addr *)&neigh->primary_key;
 		addrconf_addr_solict_mult(target, &mcaddr);
 		ndisc_send_ns(rt->dst.dev, NULL, target, &mcaddr, NULL);
 	} else {
-		read_unlock_bh(&neigh->lock);
+		write_unlock_bh(&neigh->lock);
 	}
 }
 #else
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC(v2) net-next 01/13] ndisc: Refer/Update neigh->updated with write lock.
  2013-01-15 16:44 [RFC(v2) net-next 01/13] ndisc: Refer/Update neigh->updated with write lock YOSHIFUJI Hideaki
@ 2013-01-16  6:35 ` Cong Wang
  2013-01-16 14:04   ` YOSHIFUJI Hideaki
  0 siblings, 1 reply; 3+ messages in thread
From: Cong Wang @ 2013-01-16  6:35 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki; +Cc: netdev

On 01/16/2013 12:44 AM, YOSHIFUJI Hideaki wrote:
> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
> ---
>   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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC(v2) net-next 01/13] ndisc: Refer/Update neigh->updated with write lock.
  2013-01-16  6:35 ` Cong Wang
@ 2013-01-16 14:04   ` YOSHIFUJI Hideaki
  0 siblings, 0 replies; 3+ messages in thread
From: YOSHIFUJI Hideaki @ 2013-01-16 14:04 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, YOSHIFUJI Hideaki

Cong Wang wrote:
> On 01/16/2013 12:44 AM, YOSHIFUJI Hideaki wrote:
>> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
>> ---
>>   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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-16 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-15 16:44 [RFC(v2) net-next 01/13] ndisc: Refer/Update neigh->updated with write lock YOSHIFUJI Hideaki
2013-01-16  6:35 ` Cong Wang
2013-01-16 14:04   ` YOSHIFUJI Hideaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).