Subject: Re: namei caching of newly created files?
To: None <ups@tree.com>
From: Havard Eidnes <he@uninett.no>
List: tech-kern
Date: 01/20/2005 01:43:55
> cache_enter() should not be used by file system independent code.
> ufs_makeinode() looks like (no warranty - you need to check) the righ=
t
> place to add the call.

OK, does this look any better?

Index: ufs_vnops.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.123
diff -u -u -1 -0 -r1.123 ufs_vnops.c
--- ufs_vnops.c 21 Sep 2004 03:10:36 -0000      1.123
+++ ufs_vnops.c 20 Jan 2005 00:42:19 -0000
@@ -2107,20 +2107,21 @@
         * Make sure inode goes to disk before directory entry.
         */
        if ((error =3D VOP_UPDATE(tvp, NULL, NULL, UPDATE_DIROP)) !=3D =
0)
                goto bad;
        newdir =3D pool_get(&ufs_direct_pool, PR_WAITOK);
        ufs_makedirentry(ip, cnp, newdir);
        error =3D ufs_direnter(dvp, tvp, newdir, cnp, NULL);
        pool_put(&ufs_direct_pool, newdir);
        if (error)
                goto bad;
+       cache_enter(dvp, tvp, cnp);
        if ((cnp->cn_flags & SAVESTART) =3D=3D 0)
                PNBUF_PUT(cnp->cn_pnbuf);
        vput(dvp);
        *vpp =3D tvp;
        return (0);
 =

  bad:
        /*
         * Write error occurred trying to update the inode
         * or the directory so must deallocate the inode.

Regards,

- H=E5vard