aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_netlink.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 /drivers/scsi/scsi_netlink.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 'drivers/scsi/scsi_netlink.c')
-rw-r--r--drivers/scsi/scsi_netlink.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/drivers/scsi/scsi_netlink.c b/drivers/scsi/scsi_netlink.c
index 163acf6ad2d3..40579edca101 100644
--- a/drivers/scsi/scsi_netlink.c
+++ b/drivers/scsi/scsi_netlink.c
@@ -64,7 +64,7 @@ scsi_nl_rcv_msg(struct sk_buff *skb)
64 64
65 if (nlh->nlmsg_type != SCSI_TRANSPORT_MSG) { 65 if (nlh->nlmsg_type != SCSI_TRANSPORT_MSG) {
66 err = -EBADMSG; 66 err = -EBADMSG;
67 goto next_msg; 67 return;
68 } 68 }
69 69
70 hdr = NLMSG_DATA(nlh); 70 hdr = NLMSG_DATA(nlh);
@@ -99,27 +99,6 @@ next_msg:
99 99
100 100
101/** 101/**
102 * scsi_nl_rcv_msg -
103 * Receive handler for a socket. Extracts a received message buffer from
104 * the socket, and starts message processing.
105 *
106 * @sk: socket
107 * @len: unused
108 *
109 **/
110static void
111scsi_nl_rcv(struct sock *sk, int len)
112{
113 struct sk_buff *skb;
114
115 while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
116 scsi_nl_rcv_msg(skb);
117 kfree_skb(skb);
118 }
119}
120
121
122/**
123 * scsi_nl_rcv_event - 102 * scsi_nl_rcv_event -
124 * Event handler for a netlink socket. 103 * Event handler for a netlink socket.
125 * 104 *
@@ -168,7 +147,7 @@ scsi_netlink_init(void)
168 } 147 }
169 148
170 scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT, 149 scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT,
171 SCSI_NL_GRP_CNT, scsi_nl_rcv, NULL, 150 SCSI_NL_GRP_CNT, scsi_nl_rcv_msg, NULL,
172 THIS_MODULE); 151 THIS_MODULE);
173 if (!scsi_nl_sock) { 152 if (!scsi_nl_sock) {
174 printk(KERN_ERR "%s: register of recieve handler failed\n", 153 printk(KERN_ERR "%s: register of recieve handler failed\n",