From: Chaskiel M Grundman Date: Fri, 8 Mar 2002 06:03:34 +0000 (+0000) Subject: freebsd-use-fake-refs-to-hold-inodes-20020307 X-Git-Tag: openafs-devel_1_3_3~198 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=de6a2911468669fcc94a4c869f0e36cd09566387;p=packages%2Fo%2Fopenafs.git freebsd-use-fake-refs-to-hold-inodes-20020307 unlike macos x a fake ref works for freebsd --- diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 415ec5326..55b8dcd24 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -702,6 +702,22 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, continue; /* start over - may have raced. */ } } +#endif +#if defined(AFS_FBSD_ENV) + if (VREFCOUNT(tvc) == 1 && tvc->opens == 0 + && (tvc->states & CUnlinkedDel) == 0) { + if (!(VOP_LOCK(&tvc->v, LK_EXCLUSIVE, curproc))) { + if (VREFCOUNT(tvc) == 1 && tvc->opens == 0 + && (tvc->states & CUnlinkedDel) == 0) { + VREFCOUNT_DEC(tvc); + AFS_GUNLOCK(); /* perhaps inline inactive for locking */ + VOP_INACTIVE(&tvc->v, curproc); + AFS_GLOCK(); + } else { + VOP_UNLOCK(&tvc->v, 0, curproc); + } + } + } #endif if (VREFCOUNT(tvc) == 0 && tvc->opens == 0 && (tvc->states & CUnlinkedDel) == 0) { @@ -883,13 +899,8 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, cache_purge((struct vnode *)tvc); tvc->v.v_data=tvc; tvc->v.v_tag=VT_AFS; -#ifndef VSTANDARD tvc->v.v_usecount++; /* steal an extra ref for now so vfree never happens */ - /* this will prevent the vfs layer from reusing - * afs vnodes, but afs will eventually run out of - * vcache's and panic... - */ -#endif + /* This extra ref is dealt with above... */ #endif /* * The proper value for mvstat (for root fids) is setup by the caller.