netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6 1/3] net: add rtnl_dereference()
@ 2010-09-15 21:07 Eric Dumazet
  2010-09-16  2:30 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2010-09-15 21:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

We sometime want to dereference an rcu protected pointer while
holding RTNL. Use a macro to hide all lockdep details.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 include/linux/rtnetlink.h |    9 +++++++++
 1 files changed, 9 insertions(+)

diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 263690d..68c436b 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -760,6 +760,15 @@ extern int lockdep_rtnl_is_held(void);
 	rcu_dereference_check(p, rcu_read_lock_held() ||	\
 				 lockdep_rtnl_is_held())
 
+/**
+ * rtnl_dereference - rcu_dereference with debug checking
+ * @p: The pointer to read, prior to dereferencing
+ *
+ * Do an rcu_dereference(p), but check caller holds RTNL
+ */
+#define rtnl_dereference(p)					\
+	rcu_dereference_check(p, lockdep_rtnl_is_held())
+
 extern void rtnetlink_init(void);
 extern void __rtnl_unlock(void);
 



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

* Re: [PATCH net-next-2.6 1/3] net: add rtnl_dereference()
  2010-09-15 21:07 [PATCH net-next-2.6 1/3] net: add rtnl_dereference() Eric Dumazet
@ 2010-09-16  2:30 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-09-16  2:30 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 15 Sep 2010 23:07:15 +0200

> We sometime want to dereference an rcu protected pointer while
> holding RTNL. Use a macro to hide all lockdep details.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied.

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

end of thread, other threads:[~2010-09-16  2:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 21:07 [PATCH net-next-2.6 1/3] net: add rtnl_dereference() Eric Dumazet
2010-09-16  2:30 ` David Miller

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).