simple_unlock(&uobj->vmobjlock);
simple_unlock(&uvn->u_obj.vmobjlock);
uvn_attach(arg, accessprot)	void *arg;	vm_prot_t accessprot;{	struct vnode *vp = arg;	struct uvm_object *uobj = &vp->v_uobj;	struct vattr vattr;	int result;	struct partinfo pi;	voff_t used_vnode_size;	UVMHIST_FUNC("uvn_attach"); UVMHIST_CALLED(maphist);	UVMHIST_LOG(maphist, "(vn=0x%x)", arg,0,0,0);	used_vnode_size = (voff_t)0;	/*	 * first get a lock on the uvn.	 */	simple_lock(uobj->vmobjlock);	while (vp->v_flag & VXLOCK) {		vp->v_flag |= VXWANT;		UVMHIST_LOG(maphist, "  SLEEPING on blocked vn",0,0,0,0);		UVM_UNLOCK_AND_WAIT(vp, &uobj->vmobjlock, FALSE,		    "uvn_attach", 0);		simple_lock(&uobj->vmobjlock);		UVMHIST_LOG(maphist,"  WOKE UP",0,0,0,0);	}	/*	 * if we're mapping a BLK device, make sure it is a disk.	 */	if (vp->v_type == VBLK && bdevsw[major(vp->v_rdev)].d_type != D_DISK) {		simple_unlock(&uobj->vmobjlock);		UVMHIST_LOG(maphist,"<- done (VBLK not D_DISK!)", 0,0,0,0);		return(NULL);	}	KASSERT(vp->v_type == VREG || vp->v_type == VBLK);	/*	 * set up our idea of the size	 * if this hasn't been done already.	 */	if (vp->v_size == VSIZENOTSET) {	vp->v_flag |= VXLOCK;	simple_unlock(&uobj->vmobjlock); /* drop lock in case we sleep */		/* XXX: curproc? */	if (vp->v_type == VBLK) {		/*		 * We could implement this as a specfs getattr call, but:		 *		 *	(1) VOP_GETATTR() would get the file system		 *	    vnode operation, not the specfs operation.		 *		 *	(2) All we want is the size, anyhow.		 */		result = (*bdevsw[major(vp->v_rdev)].d_ioctl)(vp->v_rdev,		    DIOCGPART, (caddr_t)&pi, FREAD, curproc);		if (result == 0) {			/* XXX should remember blocksize */			used_vnode_size = (voff_t)pi.disklab->d_secsize *			    (voff_t)pi.part->p_size;		}	} else {		result = VOP_GETATTR(vp, &vattr, curproc->p_ucred, curproc);		if (result == 0)			used_vnode_size = vattr.va_size;	}	/* relock object */	simple_lock(&uobj->vmobjlock);	if (vp->v_flag & VXWANT)		wakeup(vp);	vp->v_flag &= ~(VXLOCK|VXWANT);	if (result != 0) {		simple_unlock(&uobj->vmobjlock); /* drop lock */		UVMHIST_LOG(maphist,"<- done (VOP_GETATTR FAILED!)", 0,0,0,0);		return(NULL);	}	vp->v_size = used_vnode_size;	}	/* unlock and return */	simple_unlock(&uobj->vmobjlock);	UVMHIST_LOG(maphist,"<- done, refcnt=%d", uvn->u_obj.uo_refs,	    0, 0, 0);	return (uobj);}