Simple find/replace of VOP_UNLOCK -> NFSVOPUNLOCK. This is done so that NFSVOPUNLOCK can be modified later to add enhanced logging and assertions.
Reviewed by: rmacklem Approved by: zml (mentor) MFC after: 2 weeks
This commit is contained in:
parent
98f234f338
commit
a998963469
@ -2006,7 +2006,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
|
||||
if (error == 0)
|
||||
error = VOP_GETACL(vp, ACL_TYPE_NFS4,
|
||||
naclp, cred, p);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
} else
|
||||
error = NFSERR_PERM;
|
||||
if (error != 0) {
|
||||
|
@ -317,7 +317,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, int fhsize,
|
||||
error = vfs_hash_get(mntp, hash, (LK_EXCLUSIVE | LK_NOWAIT), td, &nvp,
|
||||
newnfs_vncmpf, nfhp);
|
||||
if (error == 0 && nvp != NULL) {
|
||||
VOP_UNLOCK(nvp, 0);
|
||||
NFSVOPUNLOCK(nvp, 0);
|
||||
} else if (error == EBUSY) {
|
||||
/*
|
||||
* The LK_EXCLOTHER lock type tells nfs_lock1() to not try
|
||||
|
@ -1344,7 +1344,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
|
||||
/*
|
||||
* Lose the lock but keep the ref.
|
||||
*/
|
||||
VOP_UNLOCK(*vpp, 0);
|
||||
NFSVOPUNLOCK(*vpp, 0);
|
||||
return (0);
|
||||
}
|
||||
error = EIO;
|
||||
@ -1491,7 +1491,7 @@ nfs_sync(struct mount *mp, int waitfor)
|
||||
error = VOP_FSYNC(vp, waitfor, td);
|
||||
if (error)
|
||||
allerror = error;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
vrele(vp);
|
||||
|
||||
MNT_ILOCK(mp);
|
||||
|
@ -1213,7 +1213,7 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
error = vfs_busy(mp, MBF_NOWAIT);
|
||||
if (error != 0) {
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
NFSVOPUNLOCK(dvp, 0);
|
||||
error = vfs_busy(mp, 0);
|
||||
NFSVOPLOCK(dvp, ltype | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
@ -1224,7 +1224,7 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
if (error != 0)
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
NFSVOPUNLOCK(dvp, 0);
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
|
||||
cnp->cn_lkflags);
|
||||
if (error == 0)
|
||||
@ -1781,7 +1781,7 @@ nfs_rename(struct vop_rename_args *ap)
|
||||
* this condition can result in potential (silent) data loss.
|
||||
*/
|
||||
error = VOP_FSYNC(fvp, MNT_WAIT, fcnp->cn_thread);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
NFSVOPUNLOCK(fvp, 0);
|
||||
if (!error && tvp)
|
||||
error = VOP_FSYNC(tvp, MNT_WAIT, tcnp->cn_thread);
|
||||
if (error)
|
||||
@ -2945,7 +2945,7 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
cred = td->td_ucred;
|
||||
NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (vp->v_iflag & VI_DOOMED) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (EBADF);
|
||||
}
|
||||
|
||||
@ -2968,27 +2968,27 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
ap->a_fl, 0, cred, td, ap->a_id, ap->a_flags);
|
||||
if (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
|
||||
ap->a_op == F_SETLK) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
error = nfs_catnap(PZERO | PCATCH, ret,
|
||||
"ncladvl");
|
||||
if (error)
|
||||
return (EINTR);
|
||||
NFSVOPLOCK(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (vp->v_iflag & VI_DOOMED) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (EBADF);
|
||||
}
|
||||
}
|
||||
} while (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
|
||||
ap->a_op == F_SETLK);
|
||||
if (ret == NFSERR_DENIED) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (EAGAIN);
|
||||
} else if (ret == EINVAL || ret == EBADF || ret == EINTR) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (ret);
|
||||
} else if (ret != 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (EACCES);
|
||||
}
|
||||
|
||||
@ -3015,7 +3015,7 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
}
|
||||
}
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (0);
|
||||
} else if (!NFS_ISV4(vp)) {
|
||||
error = NFSVOPLOCK(vp, LK_SHARED);
|
||||
@ -3023,13 +3023,13 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
return (error);
|
||||
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) {
|
||||
size = VTONFS(vp)->n_size;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
error = lf_advlock(ap, &(vp->v_lockf), size);
|
||||
} else {
|
||||
if (nfs_advlock_p != NULL)
|
||||
error = nfs_advlock_p(ap);
|
||||
else {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
error = ENOLCK;
|
||||
}
|
||||
}
|
||||
@ -3054,10 +3054,10 @@ nfs_advlockasync(struct vop_advlockasync_args *ap)
|
||||
return (error);
|
||||
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) {
|
||||
size = VTONFS(vp)->n_size;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
error = lf_advlockasync(ap, &(vp->v_lockf), size);
|
||||
} else {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
error = EOPNOTSUPP;
|
||||
}
|
||||
return (error);
|
||||
|
@ -123,7 +123,7 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap, struct ucred *cred,
|
||||
}
|
||||
error = VOP_GETATTR(vp, &nvap->na_vattr, cred);
|
||||
if (lockedit != 0)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ nfsvno_accchk(struct vnode *vp, accmode_t accmode, struct ucred *cred,
|
||||
}
|
||||
if (error != 0) {
|
||||
if (vpislocked == 0)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -231,7 +231,7 @@ nfsvno_accchk(struct vnode *vp, accmode_t accmode, struct ucred *cred,
|
||||
}
|
||||
}
|
||||
if (vpislocked == 0)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -1099,7 +1099,7 @@ nfsvno_rename(struct nameidata *fromndp, struct nameidata *tondp,
|
||||
if (ndflag & ND_NFSV4) {
|
||||
if (NFSVOPLOCK(fvp, LK_EXCLUSIVE) == 0) {
|
||||
error = nfsrv_checkremove(fvp, 0, p);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
NFSVOPUNLOCK(fvp, 0);
|
||||
} else
|
||||
error = EPERM;
|
||||
if (tvp && !error)
|
||||
@ -1167,7 +1167,7 @@ nfsvno_link(struct nameidata *ndp, struct vnode *vp, struct ucred *cred,
|
||||
vrele(ndp->ni_dvp);
|
||||
else
|
||||
vput(ndp->ni_dvp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
} else {
|
||||
if (ndp->ni_dvp == ndp->ni_vp)
|
||||
vrele(ndp->ni_dvp);
|
||||
@ -1887,7 +1887,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
|
||||
*/
|
||||
mp = vp->v_mount;
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
nd->nd_repstat = vfs_busy(mp, 0);
|
||||
vfs_rel(mp);
|
||||
if (nd->nd_repstat != 0) {
|
||||
@ -2001,7 +2001,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
|
||||
r = VOP_LOOKUP(vp, &nvp,
|
||||
&cn);
|
||||
if (vp != nvp)
|
||||
VOP_UNLOCK(vp,
|
||||
NFSVOPUNLOCK(vp,
|
||||
0);
|
||||
}
|
||||
}
|
||||
@ -2080,7 +2080,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
|
||||
if (nvp != NULL) {
|
||||
supports_nfsv4acls =
|
||||
nfs_supportsnfsv4acls(nvp);
|
||||
VOP_UNLOCK(nvp, 0);
|
||||
NFSVOPUNLOCK(nvp, 0);
|
||||
} else
|
||||
supports_nfsv4acls = 0;
|
||||
if (refp != NULL) {
|
||||
|
@ -235,7 +235,7 @@ nfsrvd_getattr(struct nfsrv_descript *nd, int isdgram,
|
||||
} else
|
||||
at_root = 0;
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
if (at_root != 0) {
|
||||
if ((nd->nd_repstat =
|
||||
NFSVOPLOCK(tvp, LK_SHARED)) == 0) {
|
||||
@ -1276,7 +1276,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred,
|
||||
p, 1);
|
||||
if (vpp != NULL && nd->nd_repstat == 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
*vpp = vp;
|
||||
} else
|
||||
vput(vp);
|
||||
@ -1735,7 +1735,7 @@ nfsrvd_symlinksub(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
nvap, nd->nd_cred, p, 1);
|
||||
}
|
||||
if (vpp != NULL && nd->nd_repstat == 0) {
|
||||
VOP_UNLOCK(ndp->ni_vp, 0);
|
||||
NFSVOPUNLOCK(ndp->ni_vp, 0);
|
||||
*vpp = ndp->ni_vp;
|
||||
} else
|
||||
vput(ndp->ni_vp);
|
||||
|
@ -705,7 +705,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
|
||||
vrele(vp);
|
||||
vp = nvp;
|
||||
cur_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
vpnes = nes;
|
||||
}
|
||||
break;
|
||||
@ -720,7 +720,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
|
||||
vrele(vp);
|
||||
vp = nvp;
|
||||
cur_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
vpnes = nes;
|
||||
}
|
||||
break;
|
||||
@ -733,7 +733,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
|
||||
vrele(vp);
|
||||
vp = nvp;
|
||||
cur_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
vpnes = nes;
|
||||
}
|
||||
} else
|
||||
@ -840,7 +840,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
|
||||
}
|
||||
}
|
||||
/* Lookup ops return a locked vnode */
|
||||
VOP_UNLOCK(nvp, 0);
|
||||
NFSVOPUNLOCK(nvp, 0);
|
||||
}
|
||||
if (!nd->nd_repstat) {
|
||||
vrele(vp);
|
||||
|
@ -4099,7 +4099,7 @@ nfsrv_updatestable(NFSPROC_T *p)
|
||||
if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) {
|
||||
error = nfsvno_setattr(vp, &nva, NFSFPCRED(sf->nsf_fp), p,
|
||||
NULL);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
} else
|
||||
error = EPERM;
|
||||
vn_finished_write(mp);
|
||||
@ -4249,7 +4249,7 @@ nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, vnode_t vp,
|
||||
if (*haslockp == 0) {
|
||||
NFSUNLOCKSTATE();
|
||||
lktype = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSLOCKV4ROOTMUTEX();
|
||||
nfsv4_relref(&nfsv4rootfs_lock);
|
||||
do {
|
||||
@ -4417,7 +4417,7 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p,
|
||||
if (*haslockp == 0) {
|
||||
NFSUNLOCKSTATE();
|
||||
lktype = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSLOCKV4ROOTMUTEX();
|
||||
nfsv4_relref(&nfsv4rootfs_lock);
|
||||
do {
|
||||
@ -4628,7 +4628,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPROC_T *p)
|
||||
do {
|
||||
if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) {
|
||||
error = nfsrv_checkremove(vp, 0, p);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
} else
|
||||
error = EPERM;
|
||||
if (error == NFSERR_DELAY) {
|
||||
|
Loading…
Reference in New Issue
Block a user