openbsd-vrefs-20040311
authorJim Rees <rees@umich.edu>
Thu, 11 Mar 2004 19:14:46 +0000 (19:14 +0000)
committerJim Rees <rees@umich.edu>
Thu, 11 Mar 2004 19:14:46 +0000 (19:14 +0000)
OpenBSD bug fixes:
fix vnode refcount botch introduced by freebsd merge
fix yet another deadlock in the vnode reclaim path

src/afs/OBSD/osi_machdep.h
src/afs/OBSD/osi_vfsops.c
src/afs/OBSD/osi_vnodeops.c
src/afs/afs_daemons.c
src/afs/afs_osi.h

index 1cb9d78..68acc51 100644 (file)
@@ -42,9 +42,8 @@ extern struct simplelock afs_rxglobal_lock;
 /* vnode */
 #define SetAfsVnode(vn)                /* nothing; done in getnewvnode() */
 #define        IsAfsVnode(vn)  ((vn)->v_op == afs_vnodeop_p)
-#define AFS_HOLD(vp)   afs_nbsd_ref(vp)
-#define AFS_RELE(vp)   afs_nbsd_rele(vp)
-#define VN_HOLD(vp)    afs_vget((vp), 0)
+#define VN_HOLD(vp)    VREF(vp)
+#define VN_RELE(vp)    vrele(vp)
 #define osi_vnhold(avc, r) afs_vget(AFSTOV(avc), 0)
 #define va_nodeid      va_fileid
 #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,
                               struct vnode **compvpp);
 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_Free(void *p, size_t asize);
 extern int afs_vget();
index 6828212..4f6610f 100644 (file)
@@ -346,7 +346,7 @@ afs_root(struct mount *mp, struct vnode **vpp)
                    AFS_RELE(AFSTOV(afs_globalVp));
 #endif
                afs_globalVp = tvp;
-               AFS_HOLD(AFSTOV(afs_globalVp));
+               VREF(AFSTOV(afs_globalVp));
            }
            AFSTOV(tvp)->v_flag |= VROOT;
            afs_globalVFS = mp;
@@ -391,28 +391,6 @@ afs_sync(struct osi_vfs *afsp)
     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
 afs_vget(vp, lfl)
      struct vnode *vp;
index 4715adf..0b62291 100644 (file)
@@ -212,11 +212,6 @@ struct vnodeopv_desc afs_vnodeop_opv_desc =
 
 int afs_debug;
 
-#undef vrele
-#define vrele afs_nbsd_rele
-#undef VREF
-#define VREF afs_nbsd_ref
-
 int
 afs_nbsd_lookup(ap)
      struct vop_lookup_args    /* {
index 849d446..658bd4a 100644 (file)
@@ -576,12 +576,8 @@ afs_BQueue(register short aopcode, register struct vcache *avc,
 #ifdef AFS_DEC_ENV
                avc->vrefCount++;
 #else
-#if defined(AFS_NETBSD_ENV) || defined(AFS_OBSD_ENV)
-               AFS_HOLD(AFSTOV(avc));
-#else
                VN_HOLD(AFSTOV(avc));
 #endif
-#endif
            }
            tb->refCount = ause + 1;
            tb->size_parm[0] = asparm0;
index d34b03d..a573e89 100644 (file)
@@ -247,7 +247,6 @@ typedef struct timeval osi_timeval_t;
 #define USERPRI
 #endif
 
-#ifndef AFS_OBSD_ENV
 /*
  * vnode/vcache ref count manipulation
  */
@@ -256,7 +255,6 @@ typedef struct timeval osi_timeval_t;
 #else /* defined(UKERNEL) */
 #define AFS_RELE(vp) do { AFS_GUNLOCK(); VN_RELE(vp); AFS_GLOCK(); } while (0)
 #endif /* defined(UKERNEL) */
-#endif
 
 /*
  * For some reason we do bare refcount manipulation in some places, for some