diff options
Diffstat (limited to 'sys/fs/unionfs/union_vnops.c')
-rw-r--r-- | sys/fs/unionfs/union_vnops.c | 252 |
1 files changed, 126 insertions, 126 deletions
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index b5abfa7..aca606b 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -109,13 +109,13 @@ static int union_write __P((struct vop_read_args *ap)); static __inline struct vnode * -union_lock_upper(struct union_node *un, struct proc *p) +union_lock_upper(struct union_node *un, struct thread *td) { struct vnode *uppervp; if ((uppervp = un->un_uppervp) != NULL) { VREF(uppervp); - vn_lock(uppervp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, p); + vn_lock(uppervp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, td); } KASSERT((uppervp == NULL || uppervp->v_usecount > 0), ("uppervp usecount is 0")); return(uppervp); @@ -123,29 +123,29 @@ union_lock_upper(struct union_node *un, struct proc *p) static __inline void -union_unlock_upper(struct vnode *uppervp, struct proc *p) +union_unlock_upper(struct vnode *uppervp, struct thread *td) { vput(uppervp); } static __inline struct vnode * -union_lock_other(struct union_node *un, struct proc *p) +union_lock_other(struct union_node *un, struct thread *td) { struct vnode *vp; if (un->un_uppervp != NULL) { - vp = union_lock_upper(un, p); + vp = union_lock_upper(un, td); } else if ((vp = un->un_lowervp) != NULL) { VREF(vp); - vn_lock(vp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_CANRECURSE | LK_RETRY, td); } return(vp); } static __inline void -union_unlock_other(struct vnode *vp, struct proc *p) +union_unlock_other(struct vnode *vp, struct thread *td) { vput(vp); } @@ -178,7 +178,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) struct componentname *cnp; { int error; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *dvp = *pdvp; struct vnode *tdvp; struct mount *mp; @@ -201,7 +201,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) dvp = dvp->v_mount->mnt_vnodecovered; VREF(dvp); vput(tdvp); - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); } } @@ -232,7 +232,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) UDEBUG(("parentdir %p result %p flag %lx\n", dvp, tdvp, cnp->cn_flags)); if (dvp != tdvp && (cnp->cn_flags & ISLASTCN) == 0) - vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, td); /* * Lastly check if the current node is a mount point in @@ -252,7 +252,7 @@ union_lookup1(udvp, pdvp, vpp, cnp) ) { int relock_pdvp = 0; - if (vfs_busy(mp, 0, 0, p)) + if (vfs_busy(mp, 0, 0, td)) continue; if (dvp == *pdvp) @@ -261,10 +261,10 @@ union_lookup1(udvp, pdvp, vpp, cnp) dvp = NULL; error = VFS_ROOT(mp, &dvp); - vfs_unbusy(mp, p); + vfs_unbusy(mp, td); if (relock_pdvp) - vn_lock(*pdvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(*pdvp, LK_EXCLUSIVE | LK_RETRY, td); if (error) { *vpp = NULL; @@ -291,7 +291,7 @@ union_lookup(ap) struct vnode *dvp = ap->a_dvp; /* starting dir */ struct union_node *dun = VTOUNION(dvp); /* associated union node */ struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; int lockparent = cnp->cn_flags & LOCKPARENT; struct union_mount *um = MOUNTTOUNIONMOUNT(dvp->v_mount); struct ucred *saved_cred = NULL; @@ -329,7 +329,7 @@ union_lookup(ap) * We must lock upperdvp while holding our lock on dvp * to avoid a deadlock. */ - upperdvp = union_lock_upper(dun, p); + upperdvp = union_lock_upper(dun, td); /* * do the lookup in the upper level. @@ -403,7 +403,7 @@ union_lookup(ap) int terror; terror = VOP_GETATTR(upperdvp, &va, - cnp->cn_cred, cnp->cn_proc); + cnp->cn_cred, cnp->cn_thread); if (terror == 0 && (va.va_flags & OPAQUE)) iswhiteout = 1; } @@ -446,7 +446,7 @@ union_lookup(ap) * to us so we NULL it out. */ VREF(lowerdvp); - vn_lock(lowerdvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(lowerdvp, LK_EXCLUSIVE | LK_RETRY, td); lerror = union_lookup1(um->um_lowervp, &lowerdvp, &lowervp, cnp); if (lowerdvp == lowervp) vrele(lowerdvp); @@ -470,7 +470,7 @@ union_lookup(ap) if ((cnp->cn_flags & ISDOTDOT) && dun->un_pvp != NULLVP) { if ((lowervp = LOWERVP(dun->un_pvp)) != NULL) { VREF(lowervp); - vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(lowervp, LK_EXCLUSIVE | LK_RETRY, td); lerror = 0; } } @@ -533,11 +533,11 @@ union_lookup(ap) */ if (uppervp && uppervp != upperdvp) - VOP_UNLOCK(uppervp, 0, p); + VOP_UNLOCK(uppervp, 0, td); if (lowervp) - VOP_UNLOCK(lowervp, 0, p); + VOP_UNLOCK(lowervp, 0, td); if (upperdvp) - VOP_UNLOCK(upperdvp, 0, p); + VOP_UNLOCK(upperdvp, 0, td); error = union_allocvp(ap->a_vpp, dvp->v_mount, dvp, upperdvp, cnp, uppervp, lowervp, 1); @@ -600,7 +600,7 @@ out: if (*ap->a_vpp != dvp) { if ((error == 0 || error == EJUSTRETURN) && (!lockparent || (cnp->cn_flags & ISLASTCN) == 0)) { - VOP_UNLOCK(dvp, 0, p); + VOP_UNLOCK(dvp, 0, td); } } @@ -637,24 +637,24 @@ union_create(ap) { struct union_node *dun = VTOUNION(ap->a_dvp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *dvp; int error = EROFS; - if ((dvp = union_lock_upper(dun, p)) != NULL) { + if ((dvp = union_lock_upper(dun, td)) != NULL) { struct vnode *vp; struct mount *mp; error = VOP_CREATE(dvp, &vp, cnp, ap->a_vap); if (error == 0) { mp = ap->a_dvp->v_mount; - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); UDEBUG(("ALLOCVP-1 FROM %p REFS %d\n", vp, vp->v_usecount)); error = union_allocvp(ap->a_vpp, mp, NULLVP, NULLVP, cnp, vp, NULLVP, 1); UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n", *ap->a_vpp, vp->v_usecount)); } - union_unlock_upper(dvp, p); + union_unlock_upper(dvp, td); } return (error); } @@ -672,9 +672,9 @@ union_whiteout(ap) struct vnode *uppervp; int error = EOPNOTSUPP; - if ((uppervp = union_lock_upper(un, cnp->cn_proc)) != NULLVP) { + if ((uppervp = union_lock_upper(un, cnp->cn_thread)) != NULLVP) { error = VOP_WHITEOUT(un->un_uppervp, cnp, ap->a_flags); - union_unlock_upper(uppervp, cnp->cn_proc); + union_unlock_upper(uppervp, cnp->cn_thread); } return(error); } @@ -700,9 +700,9 @@ union_mknod(ap) struct vnode *dvp; int error = EROFS; - if ((dvp = union_lock_upper(dun, cnp->cn_proc)) != NULL) { + if ((dvp = union_lock_upper(dun, cnp->cn_thread)) != NULL) { error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap); - union_unlock_upper(dvp, cnp->cn_proc); + union_unlock_upper(dvp, cnp->cn_thread); } return (error); } @@ -723,14 +723,14 @@ union_open(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); struct vnode *tvp; int mode = ap->a_mode; struct ucred *cred = ap->a_cred; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int error = 0; int tvpisupper = 1; @@ -742,7 +742,7 @@ union_open(ap) * * At the end of this section tvp will be left locked. */ - if ((tvp = union_lock_upper(un, p)) == NULLVP) { + if ((tvp = union_lock_upper(un, td)) == NULLVP) { /* * If the lower vnode is being opened for writing, then * copy the file contents to the upper vnode and open that, @@ -751,12 +751,12 @@ union_open(ap) tvp = un->un_lowervp; if ((ap->a_mode & FWRITE) && (tvp->v_type == VREG)) { int docopy = !(mode & O_TRUNC); - error = union_copyup(un, docopy, cred, p); - tvp = union_lock_upper(un, p); + error = union_copyup(un, docopy, cred, td); + tvp = union_lock_upper(un, td); } else { un->un_openl++; VREF(tvp); - vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY, td); tvpisupper = 0; } } @@ -766,13 +766,13 @@ union_open(ap) */ if (error == 0) - error = VOP_OPEN(tvp, mode, cred, p); + error = VOP_OPEN(tvp, mode, cred, td); /* * Absolutely necessary or UFS will blowup */ if (error == 0 && vn_canvmio(tvp) == TRUE) { - error = vfs_object_create(tvp, p, cred); + error = vfs_object_create(tvp, td, cred); } /* @@ -780,7 +780,7 @@ union_open(ap) */ if (tvpisupper) { if (tvp) - union_unlock_upper(tvp, p); + union_unlock_upper(tvp, td); } else { vput(tvp); } @@ -800,7 +800,7 @@ union_close(ap) struct vnode *a_vp; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); @@ -833,11 +833,11 @@ union_access(ap) struct vnode *a_vp; int a_mode; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int error = EACCES; struct vnode *vp; @@ -856,15 +856,15 @@ union_access(ap) } } - if ((vp = union_lock_upper(un, p)) != NULLVP) { + if ((vp = union_lock_upper(un, td)) != NULLVP) { ap->a_vp = vp; error = VCALL(vp, VOFFSET(vop_access), ap); - union_unlock_upper(vp, p); + union_unlock_upper(vp, td); return(error); } if ((vp = un->un_lowervp) != NULLVP) { - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); ap->a_vp = vp; /* @@ -885,7 +885,7 @@ union_access(ap) error = VCALL(vp, VOFFSET(vop_access), ap); } } - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); } return(error); } @@ -912,7 +912,7 @@ union_getattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { int error; @@ -933,7 +933,7 @@ union_getattr(ap) vap = ap->a_vap; if ((vp = un->un_uppervp) != NULLVP) { - error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); + error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td); if (error) return (error); /* XXX isn't this dangerouso without a lock? */ @@ -950,7 +950,7 @@ union_getattr(ap) } if (vp != NULLVP) { - error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_p); + error = VOP_GETATTR(vp, vap, ap->a_cred, ap->a_td); if (error) return (error); /* XXX isn't this dangerous without a lock? */ @@ -968,11 +968,11 @@ union_setattr(ap) struct vnode *a_vp; struct vattr *a_vap; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vattr *vap = ap->a_vap; struct vnode *uppervp; int error; @@ -995,7 +995,7 @@ union_setattr(ap) */ if (un->un_uppervp == NULLVP && (un->un_lowervp->v_type == VREG)) { error = union_copyup(un, (ap->a_vap->va_size != 0), - ap->a_cred, ap->a_p); + ap->a_cred, ap->a_td); if (error) return (error); } @@ -1005,12 +1005,12 @@ union_setattr(ap) * otherwise return read-only filesystem error. */ error = EROFS; - if ((uppervp = union_lock_upper(un, p)) != NULLVP) { + if ((uppervp = union_lock_upper(un, td)) != NULLVP) { error = VOP_SETATTR(un->un_uppervp, ap->a_vap, - ap->a_cred, ap->a_p); + ap->a_cred, ap->a_td); if ((error == 0) && (ap->a_vap->va_size != VNOVAL)) union_newsize(ap->a_vp, ap->a_vap->va_size, VNOVAL); - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); } return (error); } @@ -1025,15 +1025,15 @@ union_read(ap) } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; struct vnode *uvp; int error; - uvp = union_lock_other(un, p); + uvp = union_lock_other(un, td); KASSERT(uvp != NULL, ("union_read: backing vnode missing!")); error = VOP_READ(uvp, ap->a_uio, ap->a_ioflag, ap->a_cred); - union_unlock_other(uvp, p); + union_unlock_other(uvp, td); /* * XXX @@ -1066,11 +1066,11 @@ union_write(ap) } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; struct vnode *uppervp; int error; - if ((uppervp = union_lock_upper(un, p)) == NULLVP) + if ((uppervp = union_lock_upper(un, td)) == NULLVP) panic("union: missing upper layer in write"); error = VOP_WRITE(uppervp, ap->a_uio, ap->a_ioflag, ap->a_cred); @@ -1085,7 +1085,7 @@ union_write(ap) if (cur > un->un_uppersz) union_newsize(ap->a_vp, cur, VNOVAL); } - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); return (error); } @@ -1093,7 +1093,7 @@ static int union_lease(ap) struct vop_lease_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; struct ucred *a_cred; int a_flag; } */ *ap; @@ -1112,7 +1112,7 @@ union_ioctl(ap) caddr_t a_data; int a_fflag; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *ovp = OTHERVP(ap->a_vp); @@ -1127,7 +1127,7 @@ union_poll(ap) struct vnode *a_vp; int a_events; struct ucred *a_cred; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *ovp = OTHERVP(ap->a_vp); @@ -1141,7 +1141,7 @@ union_revoke(ap) struct vop_revoke_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -1160,17 +1160,17 @@ union_fsync(ap) struct vnode *a_vp; struct ucred *a_cred; int a_waitfor; - struct proc *a_p; + struct thread *a_td; } */ *ap; { int error = 0; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct vnode *targetvp; struct union_node *un = VTOUNION(ap->a_vp); - if ((targetvp = union_lock_other(un, p)) != NULLVP) { - error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_waitfor, p); - union_unlock_other(targetvp, p); + if ((targetvp = union_lock_other(un, td)) != NULLVP) { + error = VOP_FSYNC(targetvp, ap->a_cred, ap->a_waitfor, td); + union_unlock_other(targetvp, td); } return (error); @@ -1194,16 +1194,16 @@ union_remove(ap) struct union_node *dun = VTOUNION(ap->a_dvp); struct union_node *un = VTOUNION(ap->a_vp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *uppervp; struct vnode *upperdvp; int error; - if ((upperdvp = union_lock_upper(dun, p)) == NULLVP) + if ((upperdvp = union_lock_upper(dun, td)) == NULLVP) panic("union remove: null upper vnode"); - if ((uppervp = union_lock_upper(un, p)) != NULLVP) { - if (union_dowhiteout(un, cnp->cn_cred, p)) + if ((uppervp = union_lock_upper(un, td)) != NULLVP) { + if (union_dowhiteout(un, cnp->cn_cred, td)) cnp->cn_flags |= DOWHITEOUT; error = VOP_REMOVE(upperdvp, uppervp, cnp); #if 0 @@ -1211,13 +1211,13 @@ union_remove(ap) if (!error) union_removed_upper(un); #endif - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); } else { error = union_mkwhiteout( MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount), upperdvp, ap->a_cnp, un->un_path); } - union_unlock_upper(upperdvp, p); + union_unlock_upper(upperdvp, td); return (error); } @@ -1238,7 +1238,7 @@ union_link(ap) } */ *ap; { struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct union_node *dun = VTOUNION(ap->a_tdvp); struct vnode *vp; struct vnode *tdvp; @@ -1250,24 +1250,24 @@ union_link(ap) struct union_node *tun = VTOUNION(ap->a_vp); if (tun->un_uppervp == NULLVP) { - vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, p); + vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td); #if 0 if (dun->un_uppervp == tun->un_dirvp) { if (dun->un_flags & UN_ULOCK) { dun->un_flags &= ~UN_ULOCK; - VOP_UNLOCK(dun->un_uppervp, 0, p); + VOP_UNLOCK(dun->un_uppervp, 0, td); } } #endif - error = union_copyup(tun, 1, cnp->cn_cred, p); + error = union_copyup(tun, 1, cnp->cn_cred, td); #if 0 if (dun->un_uppervp == tun->un_dirvp) { vn_lock(dun->un_uppervp, - LK_EXCLUSIVE | LK_RETRY, p); + LK_EXCLUSIVE | LK_RETRY, td); dun->un_flags |= UN_ULOCK; } #endif - VOP_UNLOCK(ap->a_vp, 0, p); + VOP_UNLOCK(ap->a_vp, 0, td); } vp = tun->un_uppervp; } @@ -1282,18 +1282,18 @@ union_link(ap) * is expected to be locked on return. */ - if ((tdvp = union_lock_upper(dun, p)) == NULLVP) + if ((tdvp = union_lock_upper(dun, td)) == NULLVP) return (EROFS); - VOP_UNLOCK(ap->a_tdvp, 0, p); /* unlock calling node */ + VOP_UNLOCK(ap->a_tdvp, 0, td); /* unlock calling node */ error = VOP_LINK(tdvp, vp, cnp); /* call link on upper */ /* * We have to unlock tdvp prior to relocking our calling node in * order to avoid a deadlock. */ - union_unlock_upper(tdvp, p); - vn_lock(ap->a_tdvp, LK_EXCLUSIVE | LK_RETRY, p); + union_unlock_upper(tdvp, td); + vn_lock(ap->a_tdvp, LK_EXCLUSIVE | LK_RETRY, td); return (error); } @@ -1350,9 +1350,9 @@ union_rename(ap) if (un->un_uppervp == NULLVP) { switch(fvp->v_type) { case VREG: - vn_lock(un->un_vnode, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_proc); - error = union_copyup(un, 1, ap->a_fcnp->cn_cred, ap->a_fcnp->cn_proc); - VOP_UNLOCK(un->un_vnode, 0, ap->a_fcnp->cn_proc); + vn_lock(un->un_vnode, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_thread); + error = union_copyup(un, 1, ap->a_fcnp->cn_cred, ap->a_fcnp->cn_thread); + VOP_UNLOCK(un->un_vnode, 0, ap->a_fcnp->cn_thread); if (error) goto bad; break; @@ -1368,12 +1368,12 @@ union_rename(ap) #if 0 vrele(fvp); fvp = NULL; - vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_proc); + vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY, ap->a_fcnp->cn_thread); error = union_mkshadow(um, fdvp, ap->a_fcnp, &un->un_uppervp); - VOP_UNLOCK(fdvp, 0, ap->a_fcnp->cn_proc); + VOP_UNLOCK(fdvp, 0, ap->a_fcnp->cn_thread); if (un->un_uppervp) - VOP_UNLOCK(un->un_uppervp, 0, ap->a_fcnp->cn_proc); + VOP_UNLOCK(un->un_uppervp, 0, ap->a_fcnp->cn_thread); if (error) goto bad; break; @@ -1417,7 +1417,7 @@ union_rename(ap) * new tdvp is a lock and reference on uppervp, put away * the old tdvp. */ - tdvp = union_lock_upper(un, ap->a_tcnp->cn_proc); + tdvp = union_lock_upper(un, ap->a_tcnp->cn_thread); vput(ap->a_tdvp); } @@ -1432,7 +1432,7 @@ union_rename(ap) if (tvp != NULLVP && tvp->v_op == union_vnodeop_p) { struct union_node *un = VTOUNION(tvp); - tvp = union_lock_upper(un, ap->a_tcnp->cn_proc); + tvp = union_lock_upper(un, ap->a_tcnp->cn_thread); vput(ap->a_tvp); /* note: tvp may be NULL */ } @@ -1473,18 +1473,18 @@ union_mkdir(ap) { struct union_node *dun = VTOUNION(ap->a_dvp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *upperdvp; int error = EROFS; - if ((upperdvp = union_lock_upper(dun, p)) != NULLVP) { + if ((upperdvp = union_lock_upper(dun, td)) != NULLVP) { struct vnode *vp; error = VOP_MKDIR(upperdvp, &vp, cnp, ap->a_vap); - union_unlock_upper(upperdvp, p); + union_unlock_upper(upperdvp, td); if (error == 0) { - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); UDEBUG(("ALLOCVP-2 FROM %p REFS %d\n", vp, vp->v_usecount)); error = union_allocvp(ap->a_vpp, ap->a_dvp->v_mount, ap->a_dvp, NULLVP, cnp, vp, NULLVP, 1); @@ -1505,25 +1505,25 @@ union_rmdir(ap) struct union_node *dun = VTOUNION(ap->a_dvp); struct union_node *un = VTOUNION(ap->a_vp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *upperdvp; struct vnode *uppervp; int error; - if ((upperdvp = union_lock_upper(dun, p)) == NULLVP) + if ((upperdvp = union_lock_upper(dun, td)) == NULLVP) panic("union rmdir: null upper vnode"); - if ((uppervp = union_lock_upper(un, p)) != NULLVP) { - if (union_dowhiteout(un, cnp->cn_cred, p)) + if ((uppervp = union_lock_upper(un, td)) != NULLVP) { + if (union_dowhiteout(un, cnp->cn_cred, td)) cnp->cn_flags |= DOWHITEOUT; error = VOP_RMDIR(upperdvp, uppervp, ap->a_cnp); - union_unlock_upper(uppervp, p); + union_unlock_upper(uppervp, td); } else { error = union_mkwhiteout( MOUNTTOUNIONMOUNT(ap->a_dvp->v_mount), dun->un_uppervp, ap->a_cnp, un->un_path); } - union_unlock_upper(upperdvp, p); + union_unlock_upper(upperdvp, td); return (error); } @@ -1546,14 +1546,14 @@ union_symlink(ap) { struct union_node *dun = VTOUNION(ap->a_dvp); struct componentname *cnp = ap->a_cnp; - struct proc *p = cnp->cn_proc; + struct thread *td = cnp->cn_thread; struct vnode *dvp; int error = EROFS; - if ((dvp = union_lock_upper(dun, p)) != NULLVP) { + if ((dvp = union_lock_upper(dun, td)) != NULLVP) { error = VOP_SYMLINK(dvp, ap->a_vpp, cnp, ap->a_vap, ap->a_target); - union_unlock_upper(dvp, p); + union_unlock_upper(dvp, td); } return (error); } @@ -1577,14 +1577,14 @@ union_readdir(ap) } */ *ap; { struct union_node *un = VTOUNION(ap->a_vp); - struct proc *p = ap->a_uio->uio_procp; + struct thread *td = ap->a_uio->uio_td; struct vnode *uvp; int error = 0; - if ((uvp = union_lock_upper(un, p)) != NULLVP) { + if ((uvp = union_lock_upper(un, td)) != NULLVP) { ap->a_vp = uvp; error = VCALL(uvp, VOFFSET(vop_readdir), ap); - union_unlock_upper(uvp, p); + union_unlock_upper(uvp, td); } return(error); } @@ -1600,15 +1600,15 @@ union_readlink(ap) int error; struct union_node *un = VTOUNION(ap->a_vp); struct uio *uio = ap->a_uio; - struct proc *p = uio->uio_procp; + struct thread *td = uio->uio_td; struct vnode *vp; - vp = union_lock_other(un, p); + vp = union_lock_other(un, td); KASSERT(vp != NULL, ("union_readlink: backing vnode missing!")); ap->a_vp = vp; error = VCALL(vp, VOFFSET(vop_readlink), ap); - union_unlock_other(vp, p); + union_unlock_other(vp, td); return (error); } @@ -1645,11 +1645,11 @@ static int union_inactive(ap) struct vop_inactive_args /* { struct vnode *a_vp; - struct proc *a_p; + struct thread *a_td; } */ *ap; { struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; struct union_node *un = VTOUNION(vp); struct vnode **vpp; @@ -1676,11 +1676,11 @@ union_inactive(ap) #if 0 if ((un->un_flags & UN_ULOCK) && un->un_uppervp) { un->un_flags &= ~UN_ULOCK; - VOP_UNLOCK(un->un_uppervp, 0, p); + VOP_UNLOCK(un->un_uppervp, 0, td); } #endif - VOP_UNLOCK(vp, 0, p); + VOP_UNLOCK(vp, 0, td); if ((un->un_flags & UN_CACHED) == 0) vgone(vp); @@ -1705,7 +1705,7 @@ union_lock(ap) { #if 0 struct vnode *vp = ap->a_vp; - struct proc *p = ap->a_p; + struct thread *td = ap->a_td; int flags = ap->a_flags; struct union_node *un; #endif @@ -1723,12 +1723,12 @@ union_lock(ap) if (un->un_uppervp != NULLVP && (flags & LK_TYPE_MASK) == LK_EXCLUSIVE) { if ((un->un_flags & UN_ULOCK) == 0 && vp->v_usecount) { - error = vn_lock(un->un_uppervp, flags, p); + error = vn_lock(un->un_uppervp, flags, td); if (error) { struct vop_unlock_args uap = { 0 }; uap.a_vp = ap->a_vp; uap.a_flags = ap->a_flags; - uap.a_p = ap->a_p; + uap.a_td = ap->a_td; vop_stdunlock(&uap); return (error); } @@ -1750,7 +1750,7 @@ union_unlock(ap) struct vop_unlock_args /* { struct vnode *a_vp; int a_flags; - struct proc *a_p; + struct thread *a_td; } */ *ap; { #if 0 @@ -1773,7 +1773,7 @@ union_unlock(ap) if ((un->un_flags & UN_ULOCK) && lockstatus(&un->un_lock, NULL) != LK_EXCLUSIVE) { un->un_flags &= ~UN_ULOCK; - VOP_UNLOCK(un->un_uppervp, LK_EXCLUSIVE, p); + VOP_UNLOCK(un->un_uppervp, LK_EXCLUSIVE, td); } #endif return(error); @@ -1788,7 +1788,7 @@ union_createvobject(ap) struct vop_createvobject_args /* { struct vnode *vp; struct ucred *cred; - struct proc *p; + struct thread *td; } */ *ap; { struct vnode *vp = ap->a_vp; @@ -1856,16 +1856,16 @@ union_pathconf(ap) } */ *ap; { int error; - struct proc *p = curproc; /* XXX */ + struct thread *td = curthread; /* XXX */ struct union_node *un = VTOUNION(ap->a_vp); struct vnode *vp; - vp = union_lock_other(un, p); + vp = union_lock_other(un, td); KASSERT(vp != NULL, ("union_pathconf: backing vnode missing!")); ap->a_vp = vp; error = VCALL(vp, VOFFSET(vop_pathconf), ap); - union_unlock_other(vp, p); + union_unlock_other(vp, td); return (error); } |