Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Aug 2008 13:51:40 -0400 (EDT)
From:      Rick Macklem <rmacklem@uoguelph.ca>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: doing vfs_hash_get when vnode locked
Message-ID:  <Pine.GSO.4.63.0808051342290.2620@muncher.cs.uoguelph.ca>
In-Reply-To: <20080805165114.GH97161@deviant.kiev.zoral.com.ua>
References:  <Pine.GSO.4.63.0808041657200.3482@muncher.cs.uoguelph.ca> <20080805083229.GB97161@deviant.kiev.zoral.com.ua> <Pine.GSO.4.63.0808051052350.27663@muncher.cs.uoguelph.ca> <20080805153221.GG97161@deviant.kiev.zoral.com.ua> <Pine.GSO.4.63.0808051242110.23305@muncher.cs.uoguelph.ca> <20080805165114.GH97161@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help


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




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