openbsd-vrefs-20040311

OpenBSD bug fixes:
fix vnode refcount botch introduced by freebsd merge
fix yet another deadlock in the vnode reclaim path
This commit is contained in:
Jim Rees 2004-03-11 19:14:46 +00:00
parent fc4ab52ec4
commit 49038f32b9
5 changed files with 3 additions and 39 deletions

View File

@ -42,9 +42,8 @@ extern struct simplelock afs_rxglobal_lock;
/* vnode */ /* vnode */
#define SetAfsVnode(vn) /* nothing; done in getnewvnode() */ #define SetAfsVnode(vn) /* nothing; done in getnewvnode() */
#define IsAfsVnode(vn) ((vn)->v_op == afs_vnodeop_p) #define IsAfsVnode(vn) ((vn)->v_op == afs_vnodeop_p)
#define AFS_HOLD(vp) afs_nbsd_ref(vp) #define VN_HOLD(vp) VREF(vp)
#define AFS_RELE(vp) afs_nbsd_rele(vp) #define VN_RELE(vp) vrele(vp)
#define VN_HOLD(vp) afs_vget((vp), 0)
#define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0) #define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0)
#define va_nodeid va_fileid #define va_nodeid va_fileid
#define vnode_t struct vnode #define vnode_t struct vnode
@ -106,8 +105,6 @@ extern int afs_nbsd_lookupname(char *fnamep, enum uio_seg segflg,
int followlink, struct vnode **dirvpp, int followlink, struct vnode **dirvpp,
struct vnode **compvpp); struct vnode **compvpp);
extern void afs_nbsd_getnewvnode(struct vcache *tvc); extern void afs_nbsd_getnewvnode(struct vcache *tvc);
extern void afs_nbsd_ref(struct vnode *);
extern void afs_nbsd_rele(struct vnode *);
extern void *afs_nbsd_Alloc(size_t asize); extern void *afs_nbsd_Alloc(size_t asize);
extern void afs_nbsd_Free(void *p, size_t asize); extern void afs_nbsd_Free(void *p, size_t asize);
extern int afs_vget(); extern int afs_vget();

View File

@ -346,7 +346,7 @@ afs_root(struct mount *mp, struct vnode **vpp)
AFS_RELE(AFSTOV(afs_globalVp)); AFS_RELE(AFSTOV(afs_globalVp));
#endif #endif
afs_globalVp = tvp; afs_globalVp = tvp;
AFS_HOLD(AFSTOV(afs_globalVp)); VREF(AFSTOV(afs_globalVp));
} }
AFSTOV(tvp)->v_flag |= VROOT; AFSTOV(tvp)->v_flag |= VROOT;
afs_globalVFS = mp; afs_globalVFS = mp;
@ -391,28 +391,6 @@ afs_sync(struct osi_vfs *afsp)
return 0; return 0;
} }
void
afs_nbsd_ref(struct vnode *vp)
{
if (vp->v_usecount == 0) {
vprint("holding unheld node", vp);
panic("afs_ref");
}
VREF(vp);
}
void
afs_nbsd_rele(struct vnode *vp)
{
AFS_GUNLOCK();
if (vp->v_usecount <= 0) {
vprint("rele'ing unheld node", vp);
panic("afs_rele");
}
vrele(vp);
AFS_GLOCK();
}
int int
afs_vget(vp, lfl) afs_vget(vp, lfl)
struct vnode *vp; struct vnode *vp;

View File

@ -212,11 +212,6 @@ struct vnodeopv_desc afs_vnodeop_opv_desc =
int afs_debug; int afs_debug;
#undef vrele
#define vrele afs_nbsd_rele
#undef VREF
#define VREF afs_nbsd_ref
int int
afs_nbsd_lookup(ap) afs_nbsd_lookup(ap)
struct vop_lookup_args /* { struct vop_lookup_args /* {

View File

@ -575,12 +575,8 @@ afs_BQueue(register short aopcode, register struct vcache *avc,
if (avc) { if (avc) {
#ifdef AFS_DEC_ENV #ifdef AFS_DEC_ENV
avc->vrefCount++; avc->vrefCount++;
#else
#if defined(AFS_NETBSD_ENV) || defined(AFS_OBSD_ENV)
AFS_HOLD(AFSTOV(avc));
#else #else
VN_HOLD(AFSTOV(avc)); VN_HOLD(AFSTOV(avc));
#endif
#endif #endif
} }
tb->refCount = ause + 1; tb->refCount = ause + 1;

View File

@ -247,7 +247,6 @@ typedef struct timeval osi_timeval_t;
#define USERPRI #define USERPRI
#endif #endif
#ifndef AFS_OBSD_ENV
/* /*
* vnode/vcache ref count manipulation * vnode/vcache ref count manipulation
*/ */
@ -256,7 +255,6 @@ typedef struct timeval osi_timeval_t;
#else /* defined(UKERNEL) */ #else /* defined(UKERNEL) */
#define AFS_RELE(vp) do { AFS_GUNLOCK(); VN_RELE(vp); AFS_GLOCK(); } while (0) #define AFS_RELE(vp) do { AFS_GUNLOCK(); VN_RELE(vp); AFS_GLOCK(); } while (0)
#endif /* defined(UKERNEL) */ #endif /* defined(UKERNEL) */
#endif
/* /*
* For some reason we do bare refcount manipulation in some places, for some * For some reason we do bare refcount manipulation in some places, for some