Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Aug 2008 22:43:41 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Rick Macklem <rmacklem@uoguelph.ca>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: doing vfs_hash_get when vnode locked
Message-ID:  <20080805194341.GI97161@deviant.kiev.zoral.com.ua>
In-Reply-To: <Pine.GSO.4.63.0808051342290.2620@muncher.cs.uoguelph.ca>
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> <Pine.GSO.4.63.0808051342290.2620@muncher.cs.uoguelph.ca>

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

--1BXV+/FYeXhtv2WT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Aug 05, 2008 at 01:51:40PM -0400, Rick Macklem wrote:
>=20
>=20
> On Tue, 5 Aug 2008, Kostik Belousov wrote:
>=20
> [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 lo=
ck.
> >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=20
> 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.
Yes, exactly.

>=20
> But, it seems that it is my nfs_unmount() that calls this, so I can just
> delay the FORCECLOSE for this weird case.
>=20
> 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.

But, what guarantees that the vnode would not be reclaimed before/under
your vref() it ? For instance, what if the vnode is locked due to reclaim
being in progress ?

--1BXV+/FYeXhtv2WT
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEUEARECAAYFAkiYrW0ACgkQC3+MBN1Mb4i3gwCXdpeU8gvT1AGkKgT2Eh2lGHcQ
gACg7k7+/cXzve/72UvEDJlIfCy1ENs=
=asfp
-----END PGP SIGNATURE-----

--1BXV+/FYeXhtv2WT--



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