Subject: Re: tmpfs: Reclaiming vnodes
To: Julio M.Merino Vidal <jmmv84@gmail.com>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 08/04/2005 21:33:35
On Aug 3, 2005, at 1:06 PM, Julio M. Merino Vidal wrote:
> 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.
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.
> *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.
Right. So don't do that in your rmdir routine... wait for the VFS
layer to reclaim the vnode, then you should be OK.
-- thorpej