svcrpc: fix rpc server shutdown races
authorJ. Bruce Fields <bfields@redhat.com>
Sun, 10 Feb 2013 21:08:11 +0000 (16:08 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Mar 2013 22:03:37 +0000 (06:03 +0800)
commitacb9bc5fb5a7fb6051002633a430c1a977388912
treea8ebff8f41d43b801064fad8d99e576713093290
parentcc5e7bc758e2d0e06d2b21ca0fd13144210735e5
svcrpc: fix rpc server shutdown races

commit cc630d9f476445927fca599f81182c7f06f79058 upstream.

Rewrite server shutdown to remove the assumption that there are no
longer any threads running (no longer true, for example, when shutting
down the service in one network namespace while it's still running in
others).

Do that by doing what we'd do in normal circumstances: just CLOSE each
socket, then enqueue it.

Since there may not be threads to handle the resulting queued xprts,
also run a simplified version of the svc_recv() loop run by a server to
clean up any closed xprts afterwards.

Tested-by: Jason Tibbitts <tibbs@math.uh.edu>
Tested-by: Paweł Sikora <pawel.sikora@agmk.net>
Acked-by: Stanislav Kinsbursky <skinsbursky@parallels.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sunrpc/svc.c
net/sunrpc/svc_xprt.c