int nfs_inactive(void *v) { struct vop_inactive_args *ap = v; struct nfsnode *np; struct sillyrename *sp; #ifdef DIAGNOSTIC if (prtactive && ap->a_vp->v_usecount != 0) vprint("nfs_inactive: pushing active", ap->a_vp); #endif if (ap->a_vp->v_flag & VLARVAL) /* * vnode was incompletely set up, just return * as we are throwing it away. */ return(0); #ifdef DIAGNOSTIC if (ap->a_vp->v_data == NULL) panic("NULL v_data (no nfsnode set up?) in vnode %p", ap->a_vp); #endif np = VTONFS(ap->a_vp); if (ap->a_vp->v_type != VDIR) { sp = np->n_sillyrename; np->n_sillyrename = NULL; } else sp = NULL; if (sp) { /* * Remove the silly file that was rename'd earlier */ nfs_vinvalbuf(ap->a_vp, 0, sp->s_cred, curproc); nfs_removeit(sp); crfree(sp->s_cred); vrele(sp->s_dvp); free(sp, M_NFSREQ, sizeof(*sp)); } np->n_flag &= (NMODIFIED | NFLUSHINPROG | NFLUSHWANT); VOP_UNLOCK(ap->a_vp, ap->a_p); return (0); }
/* * Remove a silly file that was rename'd earlier */ static void nfs_sillyworker(struct work *work, void *arg) { struct sillyrename *sp; int error; sp = (struct sillyrename *)work; error = vn_lock(sp->s_dvp, LK_EXCLUSIVE); if (error || sp->s_dvp->v_data == NULL) { /* XXX should recover */ printf("%s: vp=%p error=%d\n", __func__, sp->s_dvp, error); if (error == 0) { vput(sp->s_dvp); } else { vrele(sp->s_dvp); } } else { nfs_removeit(sp); vput(sp->s_dvp); } kauth_cred_free(sp->s_cred); kmem_free(sp, sizeof(*sp)); }