From owner-freebsd-fs@FreeBSD.ORG Tue Aug 5 17:40:26 2008 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 9F9E01065681 for ; Tue, 5 Aug 2008 17:40:26 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from moe.cs.uoguelph.ca (moe.cs.uoguelph.ca [131.104.94.198]) by mx1.freebsd.org (Postfix) with ESMTP id 5A5A48FC1E for ; Tue, 5 Aug 2008 17:40:26 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from muncher.cs.uoguelph.ca (muncher.cs.uoguelph.ca [131.104.91.102]) by moe.cs.uoguelph.ca (8.13.1/8.13.1) with ESMTP id m75HeOcH017156; Tue, 5 Aug 2008 13:40:24 -0400 Received: from localhost (rmacklem@localhost) by muncher.cs.uoguelph.ca (8.11.7p3+Sun/8.11.6) with ESMTP id m75Hpf706810; Tue, 5 Aug 2008 13:51:41 -0400 (EDT) X-Authentication-Warning: muncher.cs.uoguelph.ca: rmacklem owned process doing -bs Date: Tue, 5 Aug 2008 13:51:40 -0400 (EDT) From: Rick Macklem X-X-Sender: rmacklem@muncher.cs.uoguelph.ca To: Kostik Belousov In-Reply-To: <20080805165114.GH97161@deviant.kiev.zoral.com.ua> Message-ID: References: <20080805083229.GB97161@deviant.kiev.zoral.com.ua> <20080805153221.GG97161@deviant.kiev.zoral.com.ua> <20080805165114.GH97161@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: MIMEDefang 2.63 on 131.104.94.198 Cc: freebsd-fs@freebsd.org Subject: Re: doing vfs_hash_get when vnode locked 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, 05 Aug 2008 17:40:26 -0000 On Tue, 5 Aug 2008, Kostik Belousov wrote: [stuff snipped] >> What does v_usecount mean then, if it doesn't say "I have it in use, so >> you can't recycle it until I vrele() it"? > It means that the vnode memory will not be freed until vrele(). > > But the VOP_RECLAIM may be called any time, and it requires exclusive lock. > After vnode is reclaimed, it is reassigned to the deadfs. In particular, > VOP_RECLAIM implementation must clear v_data. > > For the reclaimed vnode you still hold a reference to, you can reliably > obtain the vnode lock. > [stuff snipped] > I do not know about these systems, esp. whether and how they implement > a forced unmount. > Ok, I just spent a few minutes snooping around in vfs_subr.c and I think I see the problem. vget() has called vholdl() and then v_upgrade_usecount(), which has incremented the usecount and taken the vnode off the free list. This appears to prevent vgonel() from being called on it for most cases, but there is still the case in vflush() where the FORCECLOSE flag is set. But, it seems that it is my nfs_unmount() that calls this, so I can just delay the FORCECLOSE for this weird case. In fact, it looks like vgonel() would call VOP_CLOSE() because v_usecount is still non-zero (active) and that would block during the recovery in my code, anyhow. Thanks for clarifying it, rick