diff options
author | NeilBrown <neilb@suse.de> | 2007-03-06 01:42:22 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-06 09:30:26 -0800 |
commit | cda1fd4abd773216a888487af0170d0cc3d50454 (patch) | |
tree | aed6662bab1789a1698644f2e1d0db4255ecad67 /net/sunrpc/svc.c | |
parent | 5a05ed73e1abfd7e0e7d474817245861deaa18af (diff) |
[PATCH] knfsd: fix recently introduced problem with shutting down a busy NFS server
When the last thread of nfsd exits, it shuts down all related sockets. It
currently uses svc_close_socket to do this, but that only is immediately
effective if the socket is not SK_BUSY.
If the socket is busy - i.e. if a request has arrived that has not yet been
processes - svc_close_socket is not effective and the shutdown process spins.
So create a new svc_force_close_socket which removes the SK_BUSY flag is set
and then calls svc_close_socket.
Also change some open-codes loops in svc_destroy to use
list_for_each_entry_safe.
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/sunrpc/svc.c')
-rw-r--r-- | net/sunrpc/svc.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 8353829bc5c6..f960b138236f 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -367,6 +367,7 @@ void svc_destroy(struct svc_serv *serv) { struct svc_sock *svsk; + struct svc_sock *tmp; dprintk("svc: svc_destroy(%s, %d)\n", serv->sv_program->pg_name, @@ -382,21 +383,17 @@ svc_destroy(struct svc_serv *serv) del_timer_sync(&serv->sv_temptimer); - while (!list_empty(&serv->sv_tempsocks)) { - svsk = list_entry(serv->sv_tempsocks.next, - struct svc_sock, - sk_list); - svc_close_socket(svsk); - } + list_for_each_entry_safe(svsk, tmp, &serv->sv_tempsocks, sk_list) + svc_force_close_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, - sk_list); - svc_close_socket(svsk); - } + list_for_each_entry_safe(svsk, tmp, &serv->sv_permsocks, sk_list) + svc_force_close_socket(svsk); + + BUG_ON(!list_empty(&serv->sv_permsocks)); + BUG_ON(!list_empty(&serv->sv_tempsocks)); cache_clean_deferred(serv); |