From owner-freebsd-fs@FreeBSD.ORG Tue Oct 19 15:11:32 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CE31106564A; Tue, 19 Oct 2010 15:11:32 +0000 (UTC) (envelope-from gleb.kurtsou@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 25E988FC15; Tue, 19 Oct 2010 15:11:31 +0000 (UTC) Received: by pzk2 with SMTP id 2so547171pzk.13 for ; Tue, 19 Oct 2010 08:11:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=aPFJf82vRousVSfZxRCmS1A6CYqpC+RChUxV8QvwNvM=; b=bX7CObLR0xqXJXsGELZiLFXxILaYz0NkikB94W6Ew91HtiPI3sPqi9bVZru9MHp9m0 vsoIEdd/FI5PTzPAEeFxA/lsIgzriKd/aiVsNyVjbS3w4cELnGS7ynnmQtLxjbT1yBz7 sLXtNLAig0JIp3BqMnmiFOmkbwmCaBgN+6y6E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=fsHD/9oxiRygpfNP7Mw0kHKOtDbuv9WAIolrPjElRSZ+pje/eTH7U8sBKoEbedJf0V ZCTs7+1Y4ThLKt+oDvMlhTGBz71eGBScSndlufq/s3WlykuNOyW6Krng/SldFhTRaBw5 AJNwYl20uyq/c/1iNxYSUXqRxgP+CgtUYINco= Received: by 10.14.37.10 with SMTP id x10mr3735334eea.30.1287498965715; Tue, 19 Oct 2010 07:36:05 -0700 (PDT) Received: from localhost (lan-78-157-92-5.vln.skynet.lt [78.157.92.5]) by mx.google.com with ESMTPS id w20sm248052eeh.6.2010.10.19.07.36.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 19 Oct 2010 07:36:03 -0700 (PDT) Date: Tue, 19 Oct 2010 17:36:01 +0300 From: Gleb Kurtsou To: Gleb Smirnoff Message-ID: <20101019143601.GA1982@tops> References: <201010181230.o9ICUEAi016474@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <201010181230.o9ICUEAi016474@freefall.freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-fs@FreeBSD.org Subject: Re: misc/151111: vnodes leakage during zfs unmount X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Oct 2010 15:11:32 -0000 On (18/10/2010 12:30), Gleb Smirnoff wrote: > The following reply was made to PR kern/151111; it has been noted by GNATS. > > From: Gleb Smirnoff > To: "Oleg A. Mamontov" > Cc: kib@FreeBSD.org, pjd@FreeBSD.org, freebsd-gnats-submit@FreeBSD.org > Subject: Re: misc/151111: vnodes leakage during zfs unmount > Date: Mon, 18 Oct 2010 16:11:55 +0400 > > On Thu, Sep 30, 2010 at 11:56:18AM +0000, Oleg A. Mamontov wrote: > O> for i in `jot 1000`; do zfs mount tank; printf '%4d ' $i; sysctl vfs.numvnodes; zfs umount tank; done > O> ######################## > O> 1 vfs.numvnodes: 708 > O> 2 vfs.numvnodes: 709 > O> 3 vfs.numvnodes: 710 > O> 4 vfs.numvnodes: 711 > O> 5 vfs.numvnodes: 712 > O> > O> .. > O> > O> 995 vfs.numvnodes: 1702 > O> 996 vfs.numvnodes: 1703 > O> 997 vfs.numvnodes: 1704 > O> 998 vfs.numvnodes: 1705 > O> 999 vfs.numvnodes: 1706 > O> 1000 vfs.numvnodes: 1707 In my tests zfs vnodes are getting properly gc'ed. Most likely maxvnodes limit is not hit during the test, thus vnodes are not reclaimed. Try making all available vnodes used, e.g. by running 'find /usr >/dev/null' before the test. Running the test you'll see vfs.numvnodes going up and down. It's more visible after lowering kern.maxvnodes. I've used kern.maxvnodes=1000. Default value on my system is ~127000. > Here is my lame investigation of the problem. In the zfs_domount() function > we've got the following code: > > /* Grab extra reference. */ > VERIFY(VFS_ROOT(vfsp, LK_EXCLUSIVE, &vp) == 0); > VOP_UNLOCK(vp, 0); > > I suppose this code is expected to put an extra reference on the > vfsp->mnt_vnodecovered vnode. Do I mistake here? If I don't then this is > the source of leak. > > Debugging shows that zfs_zget(), called subsequently from zfs_root(), > does not find an existing znode/vnode and allocates a new one, see at the > end of zfs_zget() function. This vnode gots a reference and is forgotten. > > Sorry, if I am being mistaken :) > > -- > Totus tuus, Glebius. > _______________________________________________ > freebsd-fs@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-fs > To unsubscribe, send any mail to "freebsd-fs-unsubscribe@freebsd.org"