From 86b1309c7e411b7c25dc0dc7a092582a4d291044 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Thu, 10 Nov 2011 19:14:51 -0800 Subject: genetlink: Add lockdep_genl_is_held(). Open vSwitch uses genl_mutex locking to protect datapath data-structures like flow-table, flow-actions. Following patch adds lockdep_genl_is_held() which is used for rcu annotation to prove locking. Signed-off-by: Pravin B Shelar Signed-off-by: Jesse Gross --- include/linux/genetlink.h | 3 +++ net/netlink/genetlink.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/include/linux/genetlink.h b/include/linux/genetlink.h index 61549b26ad6f..59311adfb0e0 100644 --- a/include/linux/genetlink.h +++ b/include/linux/genetlink.h @@ -85,6 +85,9 @@ enum { /* All generic netlink requests are serialized by a global lock. */ extern void genl_lock(void); extern void genl_unlock(void); +#ifdef CONFIG_PROVE_LOCKING +extern int lockdep_genl_is_held(void); +#endif #endif /* __KERNEL__ */ diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 8a36599d3555..28453ae2a97b 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -33,6 +33,14 @@ void genl_unlock(void) } EXPORT_SYMBOL(genl_unlock); +#ifdef CONFIG_PROVE_LOCKING +int lockdep_genl_is_held(void) +{ + return lockdep_is_held(&genl_mutex); +} +EXPORT_SYMBOL(lockdep_genl_is_held); +#endif + #define GENL_FAM_TAB_SIZE 16 #define GENL_FAM_TAB_MASK (GENL_FAM_TAB_SIZE - 1) -- cgit v1.2.3