summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorSowmini Varadhan <sowmini.varadhan@oracle.com>2016-05-18 10:06:23 -0700
committerDavid S. Miller <davem@davemloft.net>2016-05-20 19:19:57 -0400
commit37e14f4fe2991f6089a9c8a3830e3ab634ec7190 (patch)
treeae8fd4ac36094170b29eb6dc73027773b23c60ba /net
parentfc64869c48494a401b1fb627c9ecc4e6c1d74b0d (diff)
RDS: TCP: rds_tcp_accept_worker() must exit gracefully when terminating rds-tcp
There are two instances where we want to terminate RDS-TCP: when exiting the netns or during module unload. In either case, the termination sequence is to stop the listen socket, mark the rtn->rds_tcp_listen_sock as null, and flush any accept workqs. Thus any workqs that get flushed at this point will encounter a null rds_tcp_listen_sock, and must exit gracefully to allow the RDS-TCP termination to complete successfully. Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/rds/tcp_listen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index 3fa367945105..094a8cae0ef1 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -80,6 +80,9 @@ int rds_tcp_accept_one(struct socket *sock)
int conn_state;
struct sock *nsk;
+ if (!sock) /* module unload or netns delete in progress */
+ return -ENETUNREACH;
+
ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family,
sock->sk->sk_type, sock->sk->sk_protocol,
&new_sock);