]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
tipc: return early for non-blocking sockets at link congestion
authorParthasarathy Bhuvaragan <parthasarathy.bhuvaragan@ericsson.com>
Tue, 1 Nov 2016 13:02:34 +0000 (14:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Nov 2016 15:53:23 +0000 (11:53 -0400)
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>
net/tipc/socket.c

index f9f5f3c3dab530c0b798d314873800500ccc30b5..adf3e6ecf61ef1ab3df6bd34f85cb2ffaa3de6ac 100644 (file)
@@ -697,6 +697,9 @@ static int tipc_sendmcast(struct  socket *sock, struct tipc_name_seq *seq,
        uint mtu;
        int rc;
 
+       if (!timeo && tsk->link_cong)
+               return -ELINKCONG;
+
        msg_set_type(mhdr, TIPC_MCAST_MSG);
        msg_set_lookup_scope(mhdr, TIPC_CLUSTER_SCOPE);
        msg_set_destport(mhdr, 0);
@@ -1072,6 +1075,9 @@ static int __tipc_send_stream(struct socket *sock, struct msghdr *m, size_t dsz)
        }
 
        timeo = sock_sndtimeo(sk, m->msg_flags & MSG_DONTWAIT);
+       if (!timeo && tsk->link_cong)
+               return -ELINKCONG;
+
        dnode = tsk_peer_node(tsk);
        skb_queue_head_init(&pktchain);