aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2007-02-08 17:20:30 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-09 12:25:47 -0500
commitaaf68cfbf2241d24d46583423f6bff5c47e088b3 (patch)
tree65ca14b85d28b12da097d7d187cebfef88b5ba3a /include/linux
parent387bb17374c5fa057462d00d4ba941d49f45de4d (diff)
[PATCH] knfsd: fix a race in closing NFSd connections
If you lose this race, it can iput a socket inode twice and you get a BUG in fs/inode.c When I added the option for user-space to close a socket, I added some cruft to svc_delete_socket so that I could call that function when closing a socket per user-space request. This was the wrong thing to do. I should have just set SK_CLOSE and let normal mechanisms do the work. Not only wrong, but buggy. The locking is all wrong and it openned up a race where-by a socket could be closed twice. So this patch: Introduces svc_close_socket which sets SK_CLOSE then either leave the close up to a thread, or calls svc_delete_socket if it can get SK_BUSY. Adds a bias to sk_busy which is removed when SK_DEAD is set, This avoid races around shutting down the socket. Changes several 'spin_lock' to 'spin_lock_bh' where the _bh was missing. Bugzilla-url: http://bugzilla.kernel.org/show_bug.cgi?id=7916 Signed-off-by: Neil Brown <neilb@suse.de> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/sunrpc/svcsock.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/sunrpc/svcsock.h b/include/linux/sunrpc/svcsock.h
index 98b21ad370fd..db312a1e2eeb 100644
--- a/include/linux/sunrpc/svcsock.h
+++ b/include/linux/sunrpc/svcsock.h
@@ -63,7 +63,7 @@ struct svc_sock {
63 * Function prototypes. 63 * Function prototypes.
64 */ 64 */
65int svc_makesock(struct svc_serv *, int, unsigned short); 65int svc_makesock(struct svc_serv *, int, unsigned short);
66void svc_delete_socket(struct svc_sock *); 66void svc_close_socket(struct svc_sock *);
67int svc_recv(struct svc_rqst *, long); 67int svc_recv(struct svc_rqst *, long);
68int svc_send(struct svc_rqst *); 68int svc_send(struct svc_rqst *);
69void svc_drop(struct svc_rqst *); 69void svc_drop(struct svc_rqst *);