Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 19 Oct 2010 17:47:33 +0300
From:      Gleb Kurtsou <gleb.kurtsou@gmail.com>
To:        Gleb Smirnoff <glebius@FreeBSD.org>
Cc:        freebsd-fs@FreeBSD.org
Subject:   Re: misc/151111: vnodes leakage during zfs unmount
Message-ID:  <20101019144733.GA2672@tops>
In-Reply-To: <20101019143601.GA1982@tops>
References:  <201010181230.o9ICUEAi016474@freefall.freebsd.org> <20101019143601.GA1982@tops>

next in thread | previous in thread | raw e-mail | index | archive | help
On (19/10/2010 17:36), Gleb Kurtsou wrote:
> 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 <glebius@FreeBSD.org>
> > To: "Oleg A. Mamontov" <oleg@mamontov.net>
> > 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.
Please ignore my previous email. There is indeed a leak.

> >  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"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101019144733.GA2672>