svn commit: r218456 - stable/7/sys/nfsserver
John Baldwin
jhb at FreeBSD.org
Tue Feb 8 21:05:08 UTC 2011
Author: jhb
Date: Tue Feb 8 21:05:07 2011
New Revision: 218456
URL: http://svn.freebsd.org/changeset/base/218456
Log:
Properly close a socket for a TCP NFS client if the NFS server notices that
the client has disconnected while attempting to fetch a request. This
accidentally works most of the time because the socket upcall is invoked
twice for some reason causing two nfsd threads to be assigned to the
same connection. The first thread notices the disconnect when soreceive()
fails, and the second thread will then cleanup the connection. Occasionally
the second thread will grab the NFSD lock before the first thread has
returned from soreceive() to mark the connection as disconnected. When that
happens, the socket is never cleaned up and is leaked.
Fix this by checking for the disconnect flag if there is an error pulling a
request from the connection and closing the socket if it nfsrv_rcv() marked
the connection as disconnected. Now the first thread will close the socket
in most cases and the socket is never leaked.
This is a direct commit to 7 as it is specific to the pre-krpc code used
in 7.
Modified:
stable/7/sys/nfsserver/nfs_syscalls.c
Modified: stable/7/sys/nfsserver/nfs_syscalls.c
==============================================================================
--- stable/7/sys/nfsserver/nfs_syscalls.c Tue Feb 8 20:39:03 2011 (r218455)
+++ stable/7/sys/nfsserver/nfs_syscalls.c Tue Feb 8 21:05:07 2011 (r218456)
@@ -366,6 +366,8 @@ nfssvc_nfsd(struct thread *td)
slp = nfsd->nfsd_slp;
}
if (error || (slp->ns_flag & SLP_VALID) == 0) {
+ if (slp->ns_flag & SLP_DISCONN)
+ nfsrv_zapsock(slp);
if (nd) {
if (nd->nd_cr != NULL)
crfree(nd->nd_cr);
More information about the svn-src-stable-7
mailing list