diff options
-rw-r--r-- | include/linux/rtnetlink.h | 4 | ||||
-rw-r--r-- | net/core/rtnetlink.c | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index b9e17407900..44c81c74453 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -740,13 +740,13 @@ extern void rtmsg_ifinfo(int type, struct net_device *dev, unsigned change); | |||
740 | extern void rtnl_lock(void); | 740 | extern void rtnl_lock(void); |
741 | extern void rtnl_unlock(void); | 741 | extern void rtnl_unlock(void); |
742 | extern int rtnl_trylock(void); | 742 | extern int rtnl_trylock(void); |
743 | extern int rtnl_is_locked(void); | ||
743 | 744 | ||
744 | extern void rtnetlink_init(void); | 745 | extern void rtnetlink_init(void); |
745 | extern void __rtnl_unlock(void); | 746 | extern void __rtnl_unlock(void); |
746 | 747 | ||
747 | #define ASSERT_RTNL() do { \ | 748 | #define ASSERT_RTNL() do { \ |
748 | if (unlikely(rtnl_trylock())) { \ | 749 | if (unlikely(!rtnl_is_locked())) { \ |
749 | rtnl_unlock(); \ | ||
750 | printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ | 750 | printk(KERN_ERR "RTNL: assertion failed at %s (%d)\n", \ |
751 | __FILE__, __LINE__); \ | 751 | __FILE__, __LINE__); \ |
752 | dump_stack(); \ | 752 | dump_stack(); \ |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index bc39e417694..cf857c4dc7b 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -82,6 +82,11 @@ int rtnl_trylock(void) | |||
82 | return mutex_trylock(&rtnl_mutex); | 82 | return mutex_trylock(&rtnl_mutex); |
83 | } | 83 | } |
84 | 84 | ||
85 | int rtnl_is_locked(void) | ||
86 | { | ||
87 | return mutex_is_locked(&rtnl_mutex); | ||
88 | } | ||
89 | |||
85 | static struct rtnl_link *rtnl_msg_handlers[NPROTO]; | 90 | static struct rtnl_link *rtnl_msg_handlers[NPROTO]; |
86 | 91 | ||
87 | static inline int rtm_msgindex(int msgtype) | 92 | static inline int rtm_msgindex(int msgtype) |
@@ -1402,6 +1407,7 @@ EXPORT_SYMBOL(rtnetlink_put_metrics); | |||
1402 | EXPORT_SYMBOL(rtnl_lock); | 1407 | EXPORT_SYMBOL(rtnl_lock); |
1403 | EXPORT_SYMBOL(rtnl_trylock); | 1408 | EXPORT_SYMBOL(rtnl_trylock); |
1404 | EXPORT_SYMBOL(rtnl_unlock); | 1409 | EXPORT_SYMBOL(rtnl_unlock); |
1410 | EXPORT_SYMBOL(rtnl_is_locked); | ||
1405 | EXPORT_SYMBOL(rtnl_unicast); | 1411 | EXPORT_SYMBOL(rtnl_unicast); |
1406 | EXPORT_SYMBOL(rtnl_notify); | 1412 | EXPORT_SYMBOL(rtnl_notify); |
1407 | EXPORT_SYMBOL(rtnl_set_sk_err); | 1413 | EXPORT_SYMBOL(rtnl_set_sk_err); |