Bug 151111 - [zfs] vnodes leakage during zfs unmount
Summary: [zfs] vnodes leakage during zfs unmount
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Andriy Gapon
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 13:00 UTC by oleg
Modified: 2013-01-21 15:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oleg 2010-09-30 13:00:15 UTC
During `zfs mount tank`, `zfs unmount tank` vfs.numvnodes is growing up to kern.maxvnodes.

How-To-Repeat: mdconfig -a -s128m -u0
zpool create tank md0
zfs umount tank
for i in `jot 1000`; do zfs mount tank; printf '%4d   ' $i; sysctl vfs.numvnodes; zfs umount tank; done
########################
 1   vfs.numvnodes: 708
 2   vfs.numvnodes: 709
 3   vfs.numvnodes: 710
 4   vfs.numvnodes: 711
 5   vfs.numvnodes: 712

..

995   vfs.numvnodes: 1702
996   vfs.numvnodes: 1703
997   vfs.numvnodes: 1704
998   vfs.numvnodes: 1705
999   vfs.numvnodes: 1706
1000   vfs.numvnodes: 1707
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2010-10-15 16:39:38 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Gleb Smirnoff freebsd_committer freebsd_triage 2010-10-18 13:11:55 UTC
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

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.
Comment 3 Andriy Gapon freebsd_committer freebsd_triage 2012-11-26 10:59:47 UTC
Responsible Changed
From-To: freebsd-fs->avg

I am interested in this one.
Comment 4 Andriy Gapon freebsd_committer freebsd_triage 2012-12-01 18:17:22 UTC
State Changed
From-To: open->patched

Should be fixed in head.
Comment 5 Andriy Gapon freebsd_committer freebsd_triage 2013-01-21 15:45:33 UTC
State Changed
From-To: patched->closed

Should be fixed now.