svcrpc: fix rpc server shutdown races
authorJ. Bruce Fields <bfields@redhat.com>
Sun, 10 Feb 2013 21:08:11 +0000 (16:08 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Sun, 17 Feb 2013 15:53:51 +0000 (10:53 -0500)
commitcc630d9f476445927fca599f81182c7f06f79058
tree3b7f67264ba2868ed4921a86af9b5d266e6019ed
parente75bafbff2270993926abcc31358361db74a9bc2
svcrpc: fix rpc server shutdown races

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.

Cc: stable@kernel.org
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>
net/sunrpc/svc.c
net/sunrpc/svc_xprt.c