error = VOP_GETATTR(vp, &np->n_vattr, curproc->p_ucred, curproc); if (error) { lockmgr(&nfs_hashlock, LK_RELEASE, 0, p); vrele(vp); return error; } uvm_vnp_setsize(vp, np->n_vattr.va_size);
nfs_nget(mntp, fhp, fhsize, npp)	struct mount *mntp;	nfsfh_t *fhp;	int fhsize;	struct nfsnode **npp;{	struct proc *p = curproc;	/* XXX */	struct nfsnode *np;	struct nfsnodehashhead *nhpp;	struct vnode *vp;	extern int (**nfsv2_vnodeop_p)__P((void *));	struct vnode *nvp;	int error;	nhpp = NFSNOHASH(nfs_hash(fhp, fhsize));loop:	for (np = nhpp->lh_first; np != 0; np = np->n_hash.le_next) {		if (mntp != NFSTOV(np)->v_mount || np->n_fhsize != fhsize ||		    bcmp((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize))			continue;		vp = NFSTOV(np);		if (vget(vp, LK_EXCLUSIVE, p))			goto loop;		*npp = np;		return(0);	}	if (lockmgr(&nfs_hashlock, LK_EXCLUSIVE|LK_SLEEPFAIL, NULL, p))		goto loop;	error = getnewvnode(VT_NFS, mntp, nfsv2_vnodeop_p, &nvp);	if (error) {		*npp = 0;		lockmgr(&nfs_hashlock, LK_RELEASE, NULL, p);		return (error);	}	vp = nvp;	np = pool_get(&nfs_node_pool, PR_WAITOK);	bzero((caddr_t)np, sizeof *np);	lockinit(&np->n_commitlock, PINOD, "nfsclock", 0, 0);	vp->v_data = np;	np->n_vnode = vp;	/* 	 * Are we getting the root? If so, make sure the vnode flags	 * are correct 	 */	{		struct nfsmount *nmp = VFSTONFS(mntp);		if ((fhsize == nmp->nm_fhsize) &&		    !bcmp(fhp, nmp->nm_fh, fhsize)) {			if (vp->v_type == VNON)				vp->v_type = VDIR;			vp->v_flag |= VROOT;		}	}		LIST_INSERT_HEAD(nhpp, np, n_hash);	if (fhsize > NFS_SMALLFH) {		np->n_fhp = malloc(fhsize, M_NFSBIGFH, M_WAITOK);	} else		np->n_fhp = &np->n_fh;	bcopy((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize);	np->n_fhsize = fhsize;	/*	 * XXXUBC doing this while holding the nfs_hashlock is bad,	 * but there's no alternative at the moment.	 */	error = VOP_GETATTR(vp, &np->n_vattr, curproc->p_ucred, curproc);	if (error) {		lockmgr(&nfs_hashlock, LK_RELEASE, 0, p);		vrele(vp);		return error;	}	uvm_vnp_setsize(vp, np->n_vattr.va_size);	lockmgr(&nfs_hashlock, LK_RELEASE, 0, p);	*npp = np;	return (0);}