aboutsummaryrefslogtreecommitdiffstats
path: root/net/decnet/netfilter/dn_rtmsg.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2007-10-11 00:15:29 -0400
committerDavid S. Miller <davem@davemloft.net>2007-10-11 00:15:29 -0400
commitcd40b7d3983c708aabe3d3008ec64ffce56d33b0 (patch)
tree0d6fe9cfd2f03fdeee126e317d4bfb145afc458d /net/decnet/netfilter/dn_rtmsg.c
parentaed815601f3f95281ab3a01f7e2cbe1bd54285a0 (diff)
[NET]: make netlink user -> kernel interface synchronious
This patch make processing netlink user -> kernel messages synchronious. This change was inspired by the talk with Alexey Kuznetsov about current netlink messages processing. He says that he was badly wrong when introduced asynchronious user -> kernel communication. The call netlink_unicast is the only path to send message to the kernel netlink socket. But, unfortunately, it is also used to send data to the user. Before this change the user message has been attached to the socket queue and sk->sk_data_ready was called. The process has been blocked until all pending messages were processed. The bad thing is that this processing may occur in the arbitrary process context. This patch changes nlk->data_ready callback to get 1 skb and force packet processing right in the netlink_unicast. Kernel -> user path in netlink_unicast remains untouched. EINTR processing for in netlink_run_queue was changed. It forces rtnl_lock drop, but the process remains in the cycle until the message will be fully processed. So, there is no need to use this kludges now. Signed-off-by: Denis V. Lunev <den@openvz.org> Acked-by: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/netfilter/dn_rtmsg.c')
-rw-r--r--net/decnet/netfilter/dn_rtmsg.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/net/decnet/netfilter/dn_rtmsg.c b/net/decnet/netfilter/dn_rtmsg.c
index ebb38feb4df..f7fba7721e6 100644
--- a/net/decnet/netfilter/dn_rtmsg.c
+++ b/net/decnet/netfilter/dn_rtmsg.c
@@ -115,17 +115,6 @@ static inline void dnrmg_receive_user_skb(struct sk_buff *skb)
115 RCV_SKB_FAIL(-EINVAL); 115 RCV_SKB_FAIL(-EINVAL);
116} 116}
117 117
118static void dnrmg_receive_user_sk(struct sock *sk, int len)
119{
120 struct sk_buff *skb;
121 unsigned int qlen = skb_queue_len(&sk->sk_receive_queue);
122
123 for (; qlen && (skb = skb_dequeue(&sk->sk_receive_queue)); qlen--) {
124 dnrmg_receive_user_skb(skb);
125 kfree_skb(skb);
126 }
127}
128
129static struct nf_hook_ops dnrmg_ops = { 118static struct nf_hook_ops dnrmg_ops = {
130 .hook = dnrmg_hook, 119 .hook = dnrmg_hook,
131 .pf = PF_DECnet, 120 .pf = PF_DECnet,
@@ -139,7 +128,8 @@ static int __init dn_rtmsg_init(void)
139 128
140 dnrmg = netlink_kernel_create(&init_net, 129 dnrmg = netlink_kernel_create(&init_net,
141 NETLINK_DNRTMSG, DNRNG_NLGRP_MAX, 130 NETLINK_DNRTMSG, DNRNG_NLGRP_MAX,
142 dnrmg_receive_user_sk, NULL, THIS_MODULE); 131 dnrmg_receive_user_skb,
132 NULL, THIS_MODULE);
143 if (dnrmg == NULL) { 133 if (dnrmg == NULL) {
144 printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket"); 134 printk(KERN_ERR "dn_rtmsg: Cannot create netlink socket");
145 return -ENOMEM; 135 return -ENOMEM;