From owner-freebsd-current@FreeBSD.ORG Fri Jul 17 19:28:08 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C3F3106566C for ; Fri, 17 Jul 2009 19:28:08 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-annu.mail.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 213328FC19 for ; Fri, 17 Jul 2009 19:28:08 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAK1tYEqDaFvK/2dsb2JhbADRRYQNBYFA X-IronPort-AV: E=Sophos;i="4.43,223,1246852800"; d="scan'208";a="39716539" Received: from fraser.cs.uoguelph.ca ([131.104.91.202]) by esa-annu-pri.mail.uoguelph.ca with ESMTP; 17 Jul 2009 15:28:04 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by fraser.cs.uoguelph.ca (Postfix) with ESMTP id 37846109C2AA; Fri, 17 Jul 2009 15:28:04 -0400 (EDT) X-Virus-Scanned: amavisd-new at fraser.cs.uoguelph.ca Received: from fraser.cs.uoguelph.ca ([127.0.0.1]) by localhost (fraser.cs.uoguelph.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AX72MsQ2ibEv; Fri, 17 Jul 2009 15:28:03 -0400 (EDT) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by fraser.cs.uoguelph.ca (Postfix) with ESMTP id 98F8E109C275; Fri, 17 Jul 2009 15:28:03 -0400 (EDT) Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id n6HJV3E05712; Fri, 17 Jul 2009 15:31:03 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Fri, 17 Jul 2009 15:30:43 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: Anonymous In-Reply-To: <861vogcyp4.fsf@gmail.com> Message-ID: References: <861vogcyp4.fsf@gmail.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-current@freebsd.org Subject: Re: [newnfs/client] -alldirs: listing files consumes too much memory X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2009 19:28:08 -0000 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@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;