diff options
Diffstat (limited to 'net/netlink')
-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; | |||
22 | 22 | ||
23 | static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ | 23 | static DEFINE_MUTEX(genl_mutex); /* serialization of message processing */ |
24 | 24 | ||
25 | static void genl_lock(void) | 25 | static inline void genl_lock(void) |
26 | { | 26 | { |
27 | mutex_lock(&genl_mutex); | 27 | mutex_lock(&genl_mutex); |
28 | } | 28 | } |
29 | 29 | ||
30 | static int genl_trylock(void) | 30 | static inline void genl_unlock(void) |
31 | { | ||
32 | return !mutex_trylock(&genl_mutex); | ||
33 | } | ||
34 | |||
35 | static void genl_unlock(void) | ||
36 | { | 31 | { |
37 | mutex_unlock(&genl_mutex); | 32 | mutex_unlock(&genl_mutex); |
38 | |||
39 | if (genl_sock && genl_sock->sk_receive_queue.qlen) | ||
40 | genl_sock->sk_data_ready(genl_sock, 0); | ||
41 | } | 33 | } |
42 | 34 | ||
43 | #define GENL_FAM_TAB_SIZE 16 | 35 | #define GENL_FAM_TAB_SIZE 16 |
@@ -483,8 +475,7 @@ static void genl_rcv(struct sock *sk, int len) | |||
483 | unsigned int qlen = 0; | 475 | unsigned int qlen = 0; |
484 | 476 | ||
485 | do { | 477 | do { |
486 | if (genl_trylock()) | 478 | genl_lock(); |
487 | return; | ||
488 | qlen = netlink_run_queue(sk, qlen, genl_rcv_msg); | 479 | qlen = netlink_run_queue(sk, qlen, genl_rcv_msg); |
489 | genl_unlock(); | 480 | genl_unlock(); |
490 | } while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen); | 481 | } while (qlen && genl_sock && genl_sock->sk_receive_queue.qlen); |