From owner-freebsd-fs@FreeBSD.ORG Mon Oct 18 12:30:14 2010 Return-Path: Delivered-To: freebsd-fs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 582111065675 for ; Mon, 18 Oct 2010 12:30:14 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 46B428FC0C for ; Mon, 18 Oct 2010 12:30:14 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o9ICUE6B016478 for ; Mon, 18 Oct 2010 12:30:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o9ICUEAi016474; Mon, 18 Oct 2010 12:30:14 GMT (envelope-from gnats) Date: Mon, 18 Oct 2010 12:30:14 GMT Message-Id: <201010181230.o9ICUEAi016474@freefall.freebsd.org> To: freebsd-fs@FreeBSD.org From: Gleb Smirnoff Cc: Subject: Re: misc/151111: vnodes leakage during zfs unmount X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Gleb Smirnoff List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Oct 2010 12:30:14 -0000 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 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.