Bring FBSD 7.X client back to life
[openafs.git] / src / afs / FBSD / osi_vnodeops.c
index 57f7db8..99a3d71 100644 (file)
@@ -481,7 +481,9 @@ afs_vop_lookup(ap)
     int flags = ap->a_cnp->cn_flags;
     int lockparent;            /* 1 => lockparent flag is set */
     int wantparent;            /* 1 => wantparent or lockparent flag */
+#ifndef AFS_FBSD80_ENV
     struct thread *p = ap->a_cnp->cn_thread;
+#endif
 
     dvp = ap->a_dvp;
     if (dvp->v_type != VDIR) {
@@ -503,8 +505,10 @@ afs_vop_lookup(ap)
     cnp->cn_flags |= MPSAFE; /* steel */
 #endif
 
+#ifndef AFS_FBSD70_ENV
     if (flags & ISDOTDOT)
        VOP_UNLOCK(dvp, 0, p);
+#endif
 
     AFS_GLOCK();
     error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred);
@@ -529,7 +533,9 @@ afs_vop_lookup(ap)
      * we also always return the vnode locked. */
 
     if (flags & ISDOTDOT) {
+       MA_VOP_UNLOCK(dvp, 0, p);
        ma_vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
+       ma_vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p);
        /* always return the child locked */
        if (lockparent && (flags & ISLASTCN)
            && (error = ma_vn_lock(dvp, LK_EXCLUSIVE, p))) {
@@ -571,7 +577,9 @@ afs_vop_create(ap)
     int error = 0;
     struct vcache *vcp;
     struct vnode *dvp = ap->a_dvp;
+#ifndef AFS_FBSD80_ENV
     struct thread *p = ap->a_cnp->cn_thread;
+#endif
     GETNAME();
 
     AFS_GLOCK();
@@ -882,12 +890,8 @@ afs_vop_getpages(struct vop_getpages_args *ap)
             * Read operation filled a partial page.
             */
            m->valid = 0;
-           vm_page_set_valid(m, 0, size - toff);
-#ifndef AFS_FBSD80_ENV
-           vm_page_undirty(m);
-#else
+           vm_page_set_validclean(m, 0, size - toff);
            KASSERT(m->dirty == 0, ("afs_getpages: page %p is dirty", m));
-#endif
        }
 
        if (i != ap->a_reqpage) {
@@ -1149,7 +1153,9 @@ afs_vop_link(ap)
     int error = 0;
     struct vnode *dvp = ap->a_tdvp;
     struct vnode *vp = ap->a_vp;
+#ifndef AFS_FBSD80_ENV
     struct thread *p = ap->a_cnp->cn_thread;
+#endif
 
     GETNAME();
     if (dvp->v_mount != vp->v_mount) {
@@ -1193,7 +1199,9 @@ afs_vop_rename(ap)
     struct vnode *tdvp = ap->a_tdvp;
     struct vnode *fvp = ap->a_fvp;
     struct vnode *fdvp = ap->a_fdvp;
+#ifndef AFS_FBSD80_ENV
     struct thread *p = fcnp->cn_thread;
+#endif
 
     /*
      * Check for cross-device rename.
@@ -1295,7 +1303,9 @@ afs_vop_mkdir(ap)
     struct vattr *vap = ap->a_vap;
     int error = 0;
     struct vcache *vcp;
+#ifndef AFS_FBSD80_ENV
     struct thread *p = ap->a_cnp->cn_thread;
+#endif
 
     GETNAME();
 #ifdef DIAGNOSTIC
@@ -1484,6 +1494,12 @@ afs_vop_reclaim(struct vop_reclaim_args *ap)
        ObtainWriteLock(&afs_xvcache, 901);
     /* reclaim the vnode and the in-memory vcache, but keep the on-disk vcache */
     code = afs_FlushVCache(avc, &slept);
+
+    if (avc->f.states & CVInit) {
+       avc->f.states &= ~CVInit;
+       afs_osi_Wakeup(&avc->f.states);
+    }
+
     if (!haveVlock)
        ReleaseWriteLock(&afs_xvcache);
     if (!haveGlock)