Subject: Re: tmpfs: Reclaiming vnodes
To: None <tech-kern@netbsd.org>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 08/05/2005 14:13:21
Thanks to all!  I've finally got this specific thing working :-)


On 8/5/05, Jason Thorpe <thorpej@shagadelic.org> wrote:
>=20
> On Aug 3, 2005, at 1:06 PM, Julio M. Merino Vidal wrote:
>=20
> > Then, I have problems with the rmdir operation itself.  I first
> > detach a_vp from its tmpfs_node by setting v_data and
> > tn_node both to NULL.  Then I call vput over a_vp, as other
> > file-systems do.  After this, I free the associated tmpfs_node
> > given that no-one else is pointing to it.
>=20
> But you'll note that other file systems don't free their v_data.
> That's because there is only one way that the VFS layer asks the file
> system to tear down the relationship.  That's the VOP_RECLAIM()
> path.  That is the only place where you should be tearing your
> tmpfs_node down.
>=20
> > *But* a_vp is not really "released".  When I unmount the
> > file-system, the kernel calls the fsync and reclaim operations
> > over the value a_vp had (the vnode used during rmdir).  As
> > this vnode has v_data set to NULL, any attempt to access the
> > structure obviously fails and panics the system.
>=20
> Right.  So don't do that in your rmdir routine... wait for the VFS
> layer to reclaim the vnode, then you should be OK.
>=20
> -- thorpej
>=20
>=20


--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/