Skip to content

Commit

Permalink
net: introduce rcu_dereference_rtnl
Browse files Browse the repository at this point in the history
We use rcu_dereference_check(p, rcu_read_lock_held() ||
lockdep_rtnl_is_held()) several times in network stack.

More usages to come too, so its time to create a helper.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Sep 8, 2010
1 parent a7a4f1c commit a6e0fc8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/linux/rtnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,17 @@ extern int rtnl_is_locked(void);
extern int lockdep_rtnl_is_held(void);
#endif /* #ifdef CONFIG_PROVE_LOCKING */

/**
* rcu_dereference_rtnl - rcu_dereference with debug checking
* @p: The pointer to read, prior to dereferencing
*
* Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
* or RTNL
*/
#define rcu_dereference_rtnl(p) \
rcu_dereference_check(p, rcu_read_lock_held() || \
lockdep_rtnl_is_held())

extern void rtnetlink_init(void);
extern void __rtnl_unlock(void);

Expand Down

0 comments on commit a6e0fc8

Please sign in to comment.