]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
net: add rtnl_dereference()
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 15 Sep 2010 11:07:15 +0000 (11:07 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 Sep 2010 02:29:45 +0000 (19:29 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/rtnetlink.h

index 263690d991a833ce6636c35eaf311efc830af896..68c436bddc8871650768fb3c5e91f4e72a2e9981 100644 (file)
@@ -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);