From spell@mermaid.itl.net.ua  Sun Oct 24 21:52:57 2004
Return-Path: <spell@mermaid.itl.net.ua>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id A085C16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Oct 2004 21:52:57 +0000 (GMT)
Received: from mermaid.itl.net.ua (ns.itl.net.ua [217.12.192.65])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2BD0D43D1D
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 24 Oct 2004 21:52:57 +0000 (GMT)
	(envelope-from spell@mermaid.itl.net.ua)
Received: by mermaid.itl.net.ua (Postfix, from userid 111)
	id 9FCE721565; Mon, 25 Oct 2004 00:52:55 +0300 (EEST)
Message-Id: <20041024215255.9FCE721565@mermaid.itl.net.ua>
Date: Mon, 25 Oct 2004 00:52:55 +0300 (EEST)
From: Irina Liakh <spell@itl.ua>
Reply-To: Irina Liakh <spell@itl.ua>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [unionfs] system runs out of vnodes
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         73094
>Category:       kern
>Synopsis:       [unionfs] system runs out of vnodes
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    daichi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 24 22:00:44 GMT 2004
>Closed-Date:    Tue Feb 13 06:10:18 GMT 2007
>Last-Modified:  Tue Feb 13 06:10:18 GMT 2007
>Originator:     Irina Liakh
>Release:        FreeBSD 5.3-BETA6 amd64
>Organization:
ITL
>Environment:
		FreeBSD 5.3-BETA6 amd64, unionfs

>Description:

While using unionfs file system, it is possible
to run out of vnodes and get still working machine,
but every process that needs allocating vnode
sleeps waiting for free vnode, so machine runs
into rather unusable state.

In normal situation, when vnode count is going
to be over, getnewvnode() routine tries
to reuse (by vtryrecycle()) existing but freed vnodes,
and numvnodes (sysctl vfs.numvnodes) stops growing.
When using unionfs (accessing files in it),
vtryrecycle() always fails. The reason is non-zero
resident_page_count field in vm_object_t-object
corresponding to vnode-to-be-reused.
Hence, getnewvnode() allocates new vnodes
until numvnodes minus freevnodes becomes greater than
desiredvnodes, after what every getnewvnode() goes to
sleep with status-for-ps "vlruwk".

>How-To-Repeat:

Mount unionfs file system by mount_unionfs 
(regardless of -b and -r options)
with great files count and directory tree
(ports tree almost always will suffice).
Run 'find <mount_point>' command.

>Fix:

Unknown.

>Release-Note:
>Audit-Trail:

From: David Schultz <das@FreeBSD.ORG>
To: Irina Liakh <spell@itl.ua>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/73094: [unionfs] system runs out of vnodes
Date: Mon, 25 Oct 2004 16:47:34 -0400

 On Mon, Oct 25, 2004, Irina Liakh wrote:
 > In normal situation, when vnode count is going
 > to be over, getnewvnode() routine tries
 > to reuse (by vtryrecycle()) existing but freed vnodes,
 > and numvnodes (sysctl vfs.numvnodes) stops growing.
 > When using unionfs (accessing files in it),
 > vtryrecycle() always fails. The reason is non-zero
 > resident_page_count field in vm_object_t-object
 > corresponding to vnode-to-be-reused.
 > Hence, getnewvnode() allocates new vnodes
 > until numvnodes minus freevnodes becomes greater than
 > desiredvnodes, after what every getnewvnode() goes to
 > sleep with status-for-ps "vlruwk".
 
 What makes you think this has something to do with the resident
 page count, as opposed to v_usecount?

From: Irina Liakh <spell@itl.ua>
To: David Schultz <das@FreeBSD.ORG>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: kern/73094: [unionfs] system runs out of vnodes
Date: Tue, 26 Oct 2004 11:21:28 +0300

 On Mon, Oct 25, 2004 at 04:47:34PM -0400, David Schultz wrote:
 > What makes you think this has something to do with the resident
 > page count, as opposed to v_usecount?
 
 I've inserted to getnewvnode()
 
 	printf("vtryrecycle() error: %d\n", error);
 
 after
 
 	error = vtryrecycle(vp);
 
 recompiled kernel, rebooted and got permanent (while find <unionfs_mount_point>)
 
 	vtryrecycle() error: 16 
 
 (EBUSY) on system console
 
 Then I've inserted similar printf()-code to vtryrecycle()
 and located that vtryrecycle fails here:
 
                 if (object->resident_page_count ||
                     object->ref_count) {
                         VM_OBJECT_UNLOCK(object);
                         error = EBUSY;
 
 Then inserted here
 
 	printf("resident_page_count=%d ref_count=%d\n",
 		object->resident_page_count, object->ref_count)
 
 and got permanent
 
 	resident_page_count=1 ref_count=0
 
 at system console.
 
Responsible-Changed-From-To: freebsd-bugs->daichi 
Responsible-Changed-By: rodrigc 
Responsible-Changed-When: Sun May 28 20:22:48 UTC 2006 
Responsible-Changed-Why:  
daichi is showing interest in unionfs 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73094 
State-Changed-From-To: open->closed 
State-Changed-By: rodrigc 
State-Changed-When: Tue Feb 13 06:09:31 UTC 2007 
State-Changed-Why:  
New unionfs implementation has been committed to RELENG_6 and CURRENT. 
This bug report is only relevant to the previous version of unionfs. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=73094 
>Unformatted:
