aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/rtnetlink.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-03-21 01:23:58 -0500
committerDavid S. Miller <davem@davemloft.net>2006-03-21 01:23:58 -0500
commit6756ae4b4e97aba48c042b4aa6b77a18f507d2cb (patch)
tree05bf37711d782fb0089d474716026c44a454f89b /net/core/rtnetlink.c
parent253aa11578c1b89757282430891bb66ae5300092 (diff)
[NET]: Convert RTNL to mutex.
This patch turns the RTNL from a semaphore to a new 2.6.16 mutex and gets rid of some of the leftover legacy. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/rtnetlink.c')
-rw-r--r--net/core/rtnetlink.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 1c15a907066f..ae10d3740faa 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -35,6 +35,7 @@
35#include <linux/skbuff.h> 35#include <linux/skbuff.h>
36#include <linux/init.h> 36#include <linux/init.h>
37#include <linux/security.h> 37#include <linux/security.h>
38#include <linux/mutex.h>
38 39
39#include <asm/uaccess.h> 40#include <asm/uaccess.h>
40#include <asm/system.h> 41#include <asm/system.h>
@@ -51,25 +52,31 @@
51#include <net/pkt_sched.h> 52#include <net/pkt_sched.h>
52#include <net/netlink.h> 53#include <net/netlink.h>
53 54
54DECLARE_MUTEX(rtnl_sem); 55static DEFINE_MUTEX(rtnl_mutex);
55 56
56void rtnl_lock(void) 57void rtnl_lock(void)
57{ 58{
58 rtnl_shlock(); 59 mutex_lock(&rtnl_mutex);
59} 60}
60 61
61int rtnl_lock_interruptible(void) 62void __rtnl_unlock(void)
62{ 63{
63 return down_interruptible(&rtnl_sem); 64 mutex_unlock(&rtnl_mutex);
64} 65}
65 66
66void rtnl_unlock(void) 67void rtnl_unlock(void)
67{ 68{
68 rtnl_shunlock(); 69 mutex_unlock(&rtnl_mutex);
69 70 if (rtnl && rtnl->sk_receive_queue.qlen)
71 rtnl->sk_data_ready(rtnl, 0);
70 netdev_run_todo(); 72 netdev_run_todo();
71} 73}
72 74
75int rtnl_trylock(void)
76{
77 return mutex_trylock(&rtnl_mutex);
78}
79
73int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len) 80int rtattr_parse(struct rtattr *tb[], int maxattr, struct rtattr *rta, int len)
74{ 81{
75 memset(tb, 0, sizeof(struct rtattr*)*maxattr); 82 memset(tb, 0, sizeof(struct rtattr*)*maxattr);
@@ -625,9 +632,9 @@ static void rtnetlink_rcv(struct sock *sk, int len)
625 unsigned int qlen = 0; 632 unsigned int qlen = 0;
626 633
627 do { 634 do {
628 rtnl_lock(); 635 mutex_lock(&rtnl_mutex);
629 netlink_run_queue(sk, &qlen, &rtnetlink_rcv_msg); 636 netlink_run_queue(sk, &qlen, &rtnetlink_rcv_msg);
630 up(&rtnl_sem); 637 mutex_unlock(&rtnl_mutex);
631 638
632 netdev_run_todo(); 639 netdev_run_todo();
633 } while (qlen); 640 } while (qlen);
@@ -704,6 +711,5 @@ EXPORT_SYMBOL(rtnetlink_links);
704EXPORT_SYMBOL(rtnetlink_put_metrics); 711EXPORT_SYMBOL(rtnetlink_put_metrics);
705EXPORT_SYMBOL(rtnl); 712EXPORT_SYMBOL(rtnl);
706EXPORT_SYMBOL(rtnl_lock); 713EXPORT_SYMBOL(rtnl_lock);
707EXPORT_SYMBOL(rtnl_lock_interruptible); 714EXPORT_SYMBOL(rtnl_trylock);
708EXPORT_SYMBOL(rtnl_sem);
709EXPORT_SYMBOL(rtnl_unlock); 715EXPORT_SYMBOL(rtnl_unlock);