From de6a2911468669fcc94a4c869f0e36cd09566387 Mon Sep 17 00:00:00 2001 From: Chaskiel M Grundman Date: Fri, 8 Mar 2002 06:03:34 +0000 Subject: [PATCH] freebsd-use-fake-refs-to-hold-inodes-20020307 unlike macos x a fake ref works for freebsd --- src/afs/afs_vcache.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) 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. -- 2.39.5