aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorErik Hugne <erik.hugne@ericsson.com>2012-10-16 10:47:06 -0400
committerPaul Gortmaker <paul.gortmaker@windriver.com>2012-11-21 14:54:32 -0500
commitc4fc298ab44011a7f7a391bf00350acf481eeaeb (patch)
tree76cf6a8e937f7168eac2c611bfc05125f3c90b4b /net
parentf288bef46443eb3a0b212c1c57b222c0497e06f6 (diff)
tipc: return POLLOUT for sockets in an unconnected state
If an implied connect is attempted on a nonblocking STREAM/SEQPACKET socket during link congestion, the connect message will be discarded and sendmsg will return EAGAIN. This is normal behavior, and the application is expected to poll the socket until POLLOUT is set, after which the connection attempt can be retried. However, the POLLOUT flag is never set for unconnected sockets and poll() always returns a zero mask. The application is then left without a trigger for when it can make another attempt at sending the message. The solution is to check if we're polling on an unconnected socket and set the POLLOUT flag if the TIPC port owned by this socket is not congested. The TIPC ports waiting on a specific link will be marked as 'not congested' when the link congestion have abated. Signed-off-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/tipc/socket.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index b5fc8ed1d1fe..59adc76905e0 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -412,7 +412,7 @@ static int get_name(struct socket *sock, struct sockaddr *uaddr,
412 * socket state flags set 412 * socket state flags set
413 * ------------ --------- 413 * ------------ ---------
414 * unconnected no read flags 414 * unconnected no read flags
415 * no write flags 415 * POLLOUT if port is not congested
416 * 416 *
417 * connecting POLLIN/POLLRDNORM if ACK/NACK in rx queue 417 * connecting POLLIN/POLLRDNORM if ACK/NACK in rx queue
418 * no write flags 418 * no write flags
@@ -442,6 +442,10 @@ static unsigned int poll(struct file *file, struct socket *sock,
442 sock_poll_wait(file, sk_sleep(sk), wait); 442 sock_poll_wait(file, sk_sleep(sk), wait);
443 443
444 switch ((int)sock->state) { 444 switch ((int)sock->state) {
445 case SS_UNCONNECTED:
446 if (!tipc_sk_port(sk)->congested)
447 mask |= POLLOUT;
448 break;
445 case SS_READY: 449 case SS_READY:
446 case SS_CONNECTED: 450 case SS_CONNECTED:
447 if (!tipc_sk_port(sk)->congested) 451 if (!tipc_sk_port(sk)->congested)