Subject: Re: [NET] ROUTE: fix rcu_dereference() uses in /proc/net/rt_cache

From: Eric Dumazet <[email-masked]>
Date: Wed, 09 Jan 2008 18:36:09 +0100

David Miller a écrit :
> From: "Paul E. McKenney" <[email-masked]>
> Date: Wed, 9 Jan 2008 06:22:58 -0800
>
>   
>> On Wed, Jan 09, 2008 at 11:37:27AM +0100, Eric Dumazet wrote:
>>     
>>> On Wed, 9 Jan 2008 20:46:37 +1100
>>> Herbert Xu <[email-masked]> wrote:
>>>
>>> diff --git a/net/ipv4/route.c b/net/ipv4/route.c
>>> index d337706..28484f3 100644
>>> --- a/net/ipv4/route.c
>>> +++ b/net/ipv4/route.c
>>> @@ -283,12 +283,12 @@ static struct rtable *rt_cache_get_first(struct seq_file *seq)
>>>  			break;
>>>  		rcu_read_unlock_bh();
>>>  	}
>>> -	return r;
>>> +	return rcu_dereference(r);
>>>  }
>>>       
>> Would it be possible to tag rt_cache_get_first() with an __acquires(RCU)
>> to help out sparse?
>>     
>
> Sparse can't handle conditional locking very well, as is done here.
> There is a seperate thread where Eric reworks how all of this
> locking is done in order to pacify sparse and be able to add the
> __acquires() etc. tags and some of us found it too ugly to
> swallow :-)
>
>   

I will post a patch series to address this point after next merge 
(net-2.6 -> net-2.6.25)

Thank you