Skip to content

Commit 37e14f4

Browse files
sowminivdavem330
authored andcommitted
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>
1 parent fc64869 commit 37e14f4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/rds/tcp_listen.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ int rds_tcp_accept_one(struct socket *sock)
8080
int conn_state;
8181
struct sock *nsk;
8282

83+
if (!sock) /* module unload or netns delete in progress */
84+
return -ENETUNREACH;
85+
8386
ret = sock_create_kern(sock_net(sock->sk), sock->sk->sk_family,
8487
sock->sk->sk_type, sock->sk->sk_protocol,
8588
&new_sock);

0 commit comments

Comments
 (0)