Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Apr 1997 14:39:46 +0100 (BST)
From:      Doug Rabson <dfr@nlsystems.com>
To:        Thomas David Rivers <ponds!rivers@dg-rtp.dg.com>
Cc:        freebsd-bugs@freebsd.org
Subject:   Re: kern/3304: NFS V2 readdir hangs
Message-ID:  <Pine.BSF.3.95q.970422143206.319A-100000@herring.nlsystems.com>
In-Reply-To: <199704220251.WAA02885@lakes.water.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 21 Apr 1997, Thomas David Rivers wrote:

> > I think the most promising candidate is the 'full socket buffers' message.
> > Could you see if that goes up consistently when you prompt the system to
> > hang.  The match between that and the reassembly number seems to show that
> > these are large packets.
> 
>  We'll do!

I have been looking at the code again today and it seems to me that the
client is not reserving enough space in its sockets when it initialises
the mount.  Your nasty directory appears to generate a reply packet which
is too large for the client to recieve.

I added some code to use a slightly less restrictive buffer size in the
NFS client.  I also tidied up the code which sets the size for readdir
requests to make it possible to set it to less than 4k and to be more
compatible with 2.1.x.  Could you try this patch, both with and without a
-r1024 argument to mount_nfs.

Index: nfs_socket.c
===================================================================
RCS file: /home/ncvs/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.22
diff -u -r1.22 nfs_socket.c
--- nfs_socket.c	1997/03/22 06:53:08	1.22
+++ nfs_socket.c	1997/04/22 13:31:23
@@ -270,8 +270,8 @@
 		so->so_snd.sb_timeo = 0;
 	}
 	if (nmp->nm_sotype == SOCK_DGRAM) {
-		sndreserve = nmp->nm_wsize + NFS_MAXPKTHDR;
-		rcvreserve = nmp->nm_rsize + NFS_MAXPKTHDR;
+		sndreserve = (nmp->nm_wsize + NFS_MAXPKTHDR) * 2;
+		rcvreserve = (nmp->nm_rsize + NFS_MAXPKTHDR) * 2;
 	} else if (nmp->nm_sotype == SOCK_SEQPACKET) {
 		sndreserve = (nmp->nm_wsize + NFS_MAXPKTHDR) * 2;
 		rcvreserve = (nmp->nm_rsize + NFS_MAXPKTHDR) * 2;
Index: nfs_vfsops.c
===================================================================
RCS file: /home/ncvs/src/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.37
diff -u -r1.37 nfs_vfsops.c
--- nfs_vfsops.c	1997/04/04 17:49:30	1.37
+++ nfs_vfsops.c	1997/04/22 13:04:47
@@ -302,12 +302,9 @@
 		}
 		pref = fxdr_unsigned(u_long, fsp->fs_dtpref);
 		if (pref < nmp->nm_readdirsize)
-			nmp->nm_readdirsize = (pref + NFS_DIRBLKSIZ - 1) &
-				~(NFS_DIRBLKSIZ - 1);
+			nmp->nm_readdirsize = pref;
 		if (max < nmp->nm_readdirsize) {
-			nmp->nm_readdirsize = max & ~(NFS_DIRBLKSIZ - 1);
-			if (nmp->nm_readdirsize == 0)
-				nmp->nm_readdirsize = max;
+			nmp->nm_readdirsize = max;
 		}
 		nmp->nm_flag |= NFSMNT_GOTFSINFO;
 	}
@@ -741,13 +738,11 @@
 
 	if ((argp->flags & NFSMNT_READDIRSIZE) && argp->readdirsize > 0) {
 		nmp->nm_readdirsize = argp->readdirsize;
-		/* Round down to multiple of blocksize */
-		nmp->nm_readdirsize &= ~(NFS_DIRBLKSIZ - 1);
-		if (nmp->nm_readdirsize < NFS_DIRBLKSIZ)
-			nmp->nm_readdirsize = NFS_DIRBLKSIZ;
 	}
 	if (nmp->nm_readdirsize > maxio)
 		nmp->nm_readdirsize = maxio;
+	if (nmp->nm_readdirsize > nmp->nm_rsize)
+		nmp->nm_readdirsize = nmp->nm_rsize;
 
 	if ((argp->flags & NFSMNT_MAXGRPS) && argp->maxgrouplist >= 0 &&
 		argp->maxgrouplist <= NFS_MAXGRPS)



--
Doug Rabson				Mail:  dfr@nlsystems.com
Nonlinear Systems Ltd.			Phone: +44 181 951 1891




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95q.970422143206.319A-100000>