Skip to content

Commit

Permalink
RDS: TCP: rds_tcp_accept_worker() must exit gracefully when terminati…
Browse files Browse the repository at this point in the history
…ng 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 <[email protected]>
Acked-by: Santosh Shilimkar <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
sowminiv authored and davem330 committed May 20, 2016
1 parent fc64869 commit 37e14f4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/rds/tcp_listen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 37e14f4

Please sign in to comment.