aboutsummaryrefslogtreecommitdiffstats
path: root/net/rxrpc/af_rxrpc.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2017-01-05 10:38:36 +0000
committerDavid Howells <dhowells@redhat.com>2017-01-09 11:10:02 +0000
commit210f035316f545e6f507e7d61e191495ba983e27 (patch)
tree2e8a73099c2adf217251136bad50a8ec4bac840b /net/rxrpc/af_rxrpc.c
parentafs: Kill afs_wait_mode (diff)
downloadlinux-dev-210f035316f545e6f507e7d61e191495ba983e27.tar.xz
linux-dev-210f035316f545e6f507e7d61e191495ba983e27.zip
rxrpc: Allow listen(sock, 0) to be used to disable listening
Allow listen() with a backlog of 0 to be used to disable listening on an AF_RXRPC socket. This also releases any preallocation, thereby making it easier for a kernel service to account for all allocated call structures when shutting down the service. The socket cannot thereafter have listening reenabled, but must rather be closed and reopened. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'net/rxrpc/af_rxrpc.c')
-rw-r--r--net/rxrpc/af_rxrpc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c
index 5f63f6dcaabb..199b46e93e64 100644
--- a/net/rxrpc/af_rxrpc.c
+++ b/net/rxrpc/af_rxrpc.c
@@ -224,6 +224,14 @@ static int rxrpc_listen(struct socket *sock, int backlog)
else
sk->sk_max_ack_backlog = old;
break;
+ case RXRPC_SERVER_LISTENING:
+ if (backlog == 0) {
+ rx->sk.sk_state = RXRPC_SERVER_LISTEN_DISABLED;
+ sk->sk_max_ack_backlog = 0;
+ rxrpc_discard_prealloc(rx);
+ ret = 0;
+ break;
+ }
default:
ret = -EBUSY;
break;