diff options
author | NeilBrown <neilb@suse.de> | 2006-10-02 02:17:44 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 07:57:17 -0700 |
commit | bc591ccff27e6a85d3a0d6fcb16cfadcc45267a8 (patch) | |
tree | 20692a805b32ce5541f7175192f8ab81975434ec /net | |
parent | 40f10522173c34e56cb9bf2fd37c62f69a427f1b (diff) |
[PATCH] knfsd: add a callback for when last rpc thread finishes
nfsd has some cleanup that it wants to do when the last thread exits, and
there will shortly be some more. So collect this all into one place and
define a callback for an rpc service to call when the service is about to be
destroyed.
[akpm@osdl.org: cleanups, build fix]
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/svc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 44b8d9d4c18..f5aee4c6167 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -26,7 +26,8 @@ * Create an RPC service */ struct svc_serv * -svc_create(struct svc_program *prog, unsigned int bufsize) +svc_create(struct svc_program *prog, unsigned int bufsize, + void (*shutdown)(struct svc_serv *serv)) { struct svc_serv *serv; int vers; @@ -39,6 +40,7 @@ svc_create(struct svc_program *prog, unsigned int bufsize) serv->sv_nrthreads = 1; serv->sv_stats = prog->pg_stats; serv->sv_bufsz = bufsize? bufsize : 4096; + serv->sv_shutdown = shutdown; xdrsize = 0; while (prog) { prog->pg_lovers = prog->pg_nvers-1; @@ -91,6 +93,9 @@ svc_destroy(struct svc_serv *serv) sk_list); svc_delete_socket(svsk); } + if (serv->sv_shutdown) + serv->sv_shutdown(serv); + while (!list_empty(&serv->sv_permsocks)) { svsk = list_entry(serv->sv_permsocks.next, struct svc_sock, |