struct proc *a_p;
} */ *ap;
{
- /*
- * We should really check to see if I/O is possible.
- */
- return (1);
+ /*
+ * We should really check to see if I/O is possible.
+ */
+ return (1);
}
int
{
struct vnode *vp = ap->a_vp;
struct vcache *vc = VTOAFS(vp);
+ int haveGlock = ISAFS_GLOCK();
AFS_STATCNT(afs_inactive);
if (prtactive && vp->v_usecount != 0)
vprint("afs_nbsd_inactive(): pushing active", vp);
- vc->states &= ~CMAPPED;
- vc->states &= ~CDirty;
+ if (!haveGlock)
+ AFS_GLOCK();
+ afs_InactiveVCache(vc, 0); /* decrs ref counts */
+ if (!haveGlock)
+ AFS_GUNLOCK();
lockinit(&vc->rwlock, PINOD, "vcache", 0, 0);
return 0;
int code, slept;
struct vnode *vp = ap->a_vp;
struct vcache *avc = VTOAFS(vp);
+ int haveGlock = ISAFS_GLOCK();
+ int haveVlock = CheckLock(&afs_xvcache);
- cache_purge(vp); /* just in case... */
-#ifdef UVM
- uvm_vnp_uncache(vp);
-#else
- vnode_pager_uncache(vp);
-#endif
-
- AFS_GLOCK();
+ if (!haveGlock)
+ AFS_GLOCK();
+ if (!haveVlock)
+ ObtainWriteLock(&afs_xvcache, 901);
#ifndef AFS_DISCON_ENV
code = afs_FlushVCache(avc, &slept); /* tosses our stuff from vnode */
#else
/* reclaim the vnode and the in-memory vcache, but keep the on-disk vcache */
code = afs_FlushVS(avc);
#endif
- AFS_GUNLOCK();
- if (!code && vp->v_data)
- panic("afs_reclaim: vnode not cleaned");
+ if (!haveVlock)
+ ReleaseWriteLock(&afs_xvcache);
+ if (!haveGlock)
+ AFS_GUNLOCK();
return code;
}
struct vnode *vp = ap->a_vp;
struct vcache *vc = VTOAFS(vp);
-#ifdef DIAGNOSTIC
if (!vc)
panic("afs_nbsd_lock: null vcache");
-#endif
return lockmgr(&vc->rwlock, ap->a_flags | LK_CANRECURSE, &vp->v_interlock, ap->a_p);
}
struct vnode *vp = ap->a_vp;
struct vcache *vc = VTOAFS(vp);
-#ifdef DIAGNOSTIC
if (!vc)
panic("afs_nbsd_unlock: null vcache");
-#endif
return lockmgr(&vc->rwlock, ap->a_flags | LK_RELEASE, &vp->v_interlock, ap->a_p);
}
{
AFS_STATCNT(afs_cntl);
switch (ap->a_name) {
- case _PC_LINK_MAX:
+ case _PC_LINK_MAX:
*ap->a_retval = LINK_MAX;
break;
- case _PC_NAME_MAX:
+ case _PC_NAME_MAX:
*ap->a_retval = NAME_MAX;
break;
- case _PC_PATH_MAX:
+ case _PC_PATH_MAX:
*ap->a_retval = PATH_MAX;
break;
- case _PC_CHOWN_RESTRICTED:
+ case _PC_CHOWN_RESTRICTED:
*ap->a_retval = 1;
break;
- case _PC_NO_TRUNC:
+ case _PC_NO_TRUNC:
*ap->a_retval = 1;
break;
- case _PC_PIPE_BUF:
+ case _PC_PIPE_BUF:
return EINVAL;
break;
- default:
+ default:
return EINVAL;
}
return 0;
if (VREFCOUNT(tvc) == 0 && tvc->opens == 0
&& (tvc->states & CUnlinkedDel) == 0) {
+#ifdef AFS_OBSD_ENV
+ /*
+ * vgone() reclaims the vnode, which calls afs_FlushVCache(),
+ * then it puts the vnode on the free list.
+ * If we don't do this we end up with a cleaned vnode that's
+ * not on the free list.
+ */
+ vgone(AFSTOV(tvc));
+ code = fv_slept = 0;
+#else
code = afs_FlushVCache(tvc, &fv_slept);
+#endif
if (code == 0) {
anumber--;
}