Subject: Re: [SPAM] Re: namei caching of newly created files?
To: Havard Eidnes <he@uninett.no>
From: Stephan Uphoff <ups@tree.com>
List: tech-kern
Date: 01/19/2005 19:25:48
cache_enter() should not be used by file system independent code.
ufs_makeinode() looks like (no warranty - you need to check) the right
place to add the call.

Stephan

On Wed, 2005-01-19 at 18:28, Havard Eidnes wrote:
> Hm,
> 
> it seems that <sys/namei.h> already has cache_enter().  I wonder
> if this patch looks sane and safe:
> 
> Index: vfs_vnops.c
> ===================================================================
> RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
> retrieving revision 1.85
> diff -u -u -1 -0 -r1.85 vfs_vnops.c
> --- vfs_vnops.c 2 Jan 2005 16:08:29 -0000       1.85
> +++ vfs_vnops.c 19 Jan 2005 23:26:20 -0000
> @@ -135,20 +135,21 @@
>                                 goto restart;
>                         }
>                         VOP_LEASE(ndp->ni_dvp, p, cred, LEASE_WRITE);
>                         error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
>                                            &ndp->ni_cnd, &va);
>                         vn_finished_write(mp, 0);
>                         if (error)
>                                 return (error);
>                         fmode &= ~O_TRUNC;
>                         vp = ndp->ni_vp;
> +                       cache_enter(ndp->ni_dvp, vp, &ndp->ni_cnd);
>                 } else {
>                         VOP_ABORTOP(ndp->ni_dvp, &ndp->ni_cnd);
>                         if (ndp->ni_dvp == ndp->ni_vp)
>                                 vrele(ndp->ni_dvp);
>                         else
>                                 vput(ndp->ni_dvp);
>                         ndp->ni_dvp = NULL;
>                         vp = ndp->ni_vp;
>                         if (fmode & O_EXCL) {
>                                 error = EEXIST;
> 
> Regards,
> 
> - Håvard
> 
>