Subject: Re: Redoing file system suspension API (update)
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
List: tech-kern
Date: 06/21/2006 16:05:53
On Wed, Jun 21, 2006 at 09:45:36PM +0900, YAMAMOTO Takashi wrote:
> > > for example,
> > >
> > > int
> > > vn_remove(const char *path)
> > > {
> > >
> > > lookup_parent(..., &dvp, ...);
> > >
> > > vngate_enter(dvp->v_mount);
> > > lock(dvp);
> > > lookup_lastcomponent(dvp, &vp, ..);
> > > VOP_REMOVE(dvp, vp, ...);
> > > vngate_leave(dvp->v_mount);
> > > }
> >
> > Why do you think "lookup_parent()" does not change file system data/metadata?
>
> lookup_parent does its own vngate_enter/leave dance.
>
> each path components can belong to different filesystems than dvp
> and i want to avoid to do vngate_enter multiple filesystems simultaneously.
>
> > What if we make lookup() gate-aware?
> >
> > - add struct mount *ni_gate, *ni_dgate to struct nameidata
> > - add an option KEEPGATES to namei() so namei() either leaves
> > the gates on return or keeps them if KEEPGATES is given.
>
> i hesitate to complicate namei, which is already too complex...
>
> besides, it's desirable to have enter/leave in the same function
> if possible, IMO. if we take the route, it's better to hide vngate_leave
> into, say, namei_done().
>
> > and this becomes
> >
> > NDINIT(..., KEEPGATES, ...)
> > namei(&nd);
> > VOP_LEASE(...)
> > ...
> > VOP_REMOVE(nd.ni_dvp, nd.ni_vp, ...);
> > vngate_leave(nd.ni_dvp->v_mount);
> > vngate_leave(nd.ni_vp->v_mount);
>
> i think it's better not to take the gate multiple times.
Ok, is it sufficient to track nd.ni_dvp in lookup() and move to nd.ni_vp if
it has a different mount (this is namei() on a mount point, should be the only
case where nd.ni_vp->v_mount != nd.ni_dvp->v_mount)?
--
Juergen Hannken-Illjes - hannken@eis.cs.tu-bs.de - TU Braunschweig (Germany)