aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>2016-11-01 09:02:34 -0400
committerDavid S. Miller <davem@davemloft.net>2016-11-01 11:53:23 -0400
commit7cf87fa27873a954f2d665dfc61fc22227d96ad8 (patch)
tree74d947199ea10ad77ec946f1d5e69ca5702f1fb3 /net/tipc/socket.c
parent169650d3eaf1ef0604ac31ba39f2ea21a8d9b2cb (diff)
tipc: return early for non-blocking sockets at link congestion
Until now, in stream/mcast send() we pass the message to the link layer even when the link is congested and add the socket to the link's wakeup queue. This is unnecessary for non-blocking sockets. If a socket is set to non-blocking and sends multicast with zero back off time while receiving EAGAIN, we exhaust the memory. In this commit, we return immediately at stream/mcast send() for non-blocking sockets. Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Parthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index f9f5f3c3dab5..adf3e6ecf61e 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -697,6 +697,9 @@ static int tipc_sendmcast(struct socket *sock, struct tipc_name_seq *seq,
697 uint mtu; 697 uint mtu;
698 int rc; 698 int rc;
699 699
700 if (!timeo && tsk->link_cong)
701 return -ELINKCONG;
702
700 msg_set_type(mhdr, TIPC_MCAST_MSG); 703 msg_set_type(mhdr, TIPC_MCAST_MSG);
701 msg_set_lookup_scope(mhdr, TIPC_CLUSTER_SCOPE); 704 msg_set_lookup_scope(mhdr, TIPC_CLUSTER_SCOPE);
702 msg_set_destport(mhdr, 0); 705 msg_set_destport(mhdr, 0);
@@ -1072,6 +1075,9 @@ static int __tipc_send_stream(struct socket *sock, struct msghdr *m, size_t dsz)
1072 } 1075 }
1073 1076
1074 timeo = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT); 1077 timeo = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT);
1078 if (!timeo && tsk->link_cong)
1079 return -ELINKCONG;
1080
1075 dnode = tsk_peer_node(tsk); 1081 dnode = tsk_peer_node(tsk);
1076 skb_queue_head_init(&pktchain); 1082 skb_queue_head_init(&pktchain);
1077 1083