diff options
author | Denis V. Lunev <den@openvz.org> | 2007-10-10 21:13:32 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-10 21:13:32 -0700 |
commit | 3b71535f357a2e5d013a44a06b0c26a6a8d8fb5b (patch) | |
tree | 259158a50b97626063a4c779e8cb2ed81c911555 /net/netlink/genetlink.c | |
parent | 1536cc0d55a2820b71daf912060fe43ec15630c2 (diff) | |
download | linux-3b71535f357a2e5d013a44a06b0c26a6a8d8fb5b.tar.bz2 |
[NET]: Make netlink processing routines semi-synchronious (inspired by rtnl) v2
The code in netfilter/nfnetlink.c and in ./net/netlink/genetlink.c looks
like outdated copy/paste from rtnetlink.c. Push them into sync with the
original.
Changes from v1:
- deleted comment in nfnetlink_rcv_msg by request of Patrick McHardy
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink/genetlink.c')
-rw-r--r-- | net/netlink/genetlink.c | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 07ef5d204a0f..3f1104dc128b 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c @@ -22,22 +22,14 @@ struct sock *genl_sock = NULL; static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ -static void genl_lock(void) +static inline void genl_lock(void) { mutex_lock(&genl_mutex); } -static int genl_trylock(void) -{ - return !mutex_trylock(&genl_mutex); -} - -static void genl_unlock(void) +static inline void genl_unlock(void) { mutex_unlock(&genl_mutex); - - if (genl_sock && genl_sock->sk_receive_queue.qlen) - genl_sock->sk_data_ready(genl_sock, 0); } #define GENL_FAM_TAB_SIZE 16 @@ -483,8 +475,7 @@ static void genl_rcv(struct sock *sk, int len) unsigned int qlen = 0; do { - if (genl_trylock()) - return; + genl_lock(); qlen = netlink_run_queue(sk, qlen, genl_rcv_msg); genl_unlock(); } while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen); |