[newnfs/client] -alldirs: listing files consumes too much memory
Rick Macklem
rmacklem at uoguelph.ca
Fri Jul 17 19:28:08 UTC 2009
On Thu, 16 Jul 2009, Anonymous wrote:
> Let's create 335 empty files in /blah and try to list them over nfsv3.
>
> # uname -vm
> FreeBSD 8.0-BETA1 #0: Sat Jul 4 03:55:14 UTC 2009 root at almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
>
> # mkdir /blah
> # (while [ $((i+=1)) -le 334 ]; do : >/blah/foo_$i; done)
> # echo / -alldirs >/etc/exports
> # /etc/rc.d/nfsd onestart
> # mount -t newnfs -o nfsv3 0:/blah /mnt
>
Ok, I figured it out. I wasn't setting mp->mnt_stat.f_iosize before
getting the root vnode and, as such, getnewvnode() was setting
bo_bsize = 0. That confused getblk(), so it would always end up
returning block0, since it uses bo_bsize for a block calc.
The patch follows, in case you're interested in testing it.
(I'll be queuing this patch up with re@ once I've tested it some more.)
Thanks again for pointing the problem out, rick
-- patch for exp. nfs client --
--- fs/nfsclient/nfs_clvfsops.c.sav 2009-07-17 12:18:42.000000000 -0400
+++ fs/nfsclient/nfs_clvfsops.c 2009-07-17 15:09:41.000000000 -0400
@@ -1194,6 +1194,12 @@
}
}
if (nmp->nm_fhsize > 0) {
+ /*
+ * Set f_iosize to NFS_DIRBLKSIZ so that bo_bsize gets set
+ * non-zero for the root vnode. f_iosize will be set correctly
+ * by nfs_statfs() before any I/O occurs.
+ */
+ mp->mnt_stat.f_iosize = NFS_DIRBLKSIZ;
error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
if (error)
goto bad;
More information about the freebsd-current
mailing list