[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B5089CA.2050202@gmail.com>
Date: Fri, 15 Jan 2010 16:29:14 +0100
From: Eric Dumazet <eric.dumazet@...il.com>
To: paulmck@...ux.vnet.ibm.com
CC: yoshfuji@...ux-ipv6.org, netdev@...r.kernel.org, mingo@...e.hu,
akpm@...ux-foundation.org, peterz@...radead.org
Subject: Re: What protects rcu_dereference() in __in6_dev_get()?
Le 15/01/2010 16:15, Paul E. McKenney a écrit :
> On Fri, Jan 15, 2010 at 06:50:15AM +0100, Eric Dumazet wrote:
>> __in6_dev_get() is called either with rcu_read_lock()/rcu_read_unlock() protection,
>> or with the RTNL mutex held.
>
> Very good! So I make a lockdep_rtnl_is_held() in net/core/rtnetlink.c:
>
> #ifdef CONFIG_PROVE_LOCKING
> int lockdep_rtnl_is_held(void)
> {
> return lockdep_is_held(&rtnl_mutex);
> }
> EXPORT_SYMBOL(lockdep_rtnl_is_held);
> #endif /* #ifdef CONFIG_PROVE_LOCKING */
>
> Then I make __in6_dev_get() look as follows:
>
> static inline struct inet6_dev *
> __in6_dev_get(struct net_device *dev)
> {
> return rcu_dereference_check(dev->ip6_ptr,
> rcu_read_lock_held() ||
> lockdep_rtnl_is_held());
> }
>
> Seem reasonable?
I guess so, but is lockdep_is_held(&mutex) actually cheking this mutex is owned by us ?
If another thread is the owner, we could miss a bug.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists