vfs: drop the mostly unused flags argument from VOP_UNLOCK
Filesystems which want to use it in limited capacity can employ the VOP_UNLOCK_FLAGS macro. Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D21427
This commit is contained in:
parent
4a20fe31c3
commit
b249ce48ea
@ -592,7 +592,7 @@ ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun,
|
||||
vn_lock(be_lun->vn, lock_flags | LK_RETRY);
|
||||
error = VOP_FSYNC(be_lun->vn, beio->io_arg ? MNT_NOWAIT : MNT_WAIT,
|
||||
curthread);
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
VOP_UNLOCK(be_lun->vn);
|
||||
|
||||
vn_finished_write(mountpoint);
|
||||
|
||||
@ -685,7 +685,7 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun,
|
||||
*/
|
||||
error = VOP_READ(be_lun->vn, &xuio, flags, file_data->cred);
|
||||
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
VOP_UNLOCK(be_lun->vn);
|
||||
SDT_PROBE0(cbb, , read, file_done);
|
||||
if (error == 0 && xuio.uio_resid > 0) {
|
||||
/*
|
||||
@ -732,7 +732,7 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun,
|
||||
* cache before returning.
|
||||
*/
|
||||
error = VOP_WRITE(be_lun->vn, &xuio, flags, file_data->cred);
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
VOP_UNLOCK(be_lun->vn);
|
||||
|
||||
vn_finished_write(mountpoint);
|
||||
SDT_PROBE0(cbb, , write, file_done);
|
||||
@ -810,7 +810,7 @@ ctl_be_block_gls_file(struct ctl_be_block_lun *be_lun,
|
||||
off = be_lun->size_bytes;
|
||||
}
|
||||
}
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
VOP_UNLOCK(be_lun->vn);
|
||||
|
||||
data = (struct scsi_get_lba_status_data *)io->scsiio.kern_data_ptr;
|
||||
scsi_u64to8b(lbalen->lba, data->descr[0].addr);
|
||||
@ -845,7 +845,7 @@ ctl_be_block_getattr_file(struct ctl_be_block_lun *be_lun, const char *attrname)
|
||||
val = statfs.f_bavail * statfs.f_bsize /
|
||||
be_lun->cbe_lun.blocksize;
|
||||
}
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
VOP_UNLOCK(be_lun->vn);
|
||||
return (val);
|
||||
}
|
||||
|
||||
@ -2188,7 +2188,7 @@ ctl_be_block_open(struct ctl_be_block_lun *be_lun, struct ctl_lun_req *req)
|
||||
snprintf(req->error_str, sizeof(req->error_str),
|
||||
"%s is not a disk or plain file", be_lun->dev_path);
|
||||
}
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
VOP_UNLOCK(be_lun->vn);
|
||||
|
||||
if (error != 0)
|
||||
ctl_be_block_close(be_lun);
|
||||
@ -2604,7 +2604,7 @@ ctl_be_block_modify(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
|
||||
else if (be_lun->vn->v_type == VREG) {
|
||||
vn_lock(be_lun->vn, LK_SHARED | LK_RETRY);
|
||||
error = ctl_be_block_open_file(be_lun, req);
|
||||
VOP_UNLOCK(be_lun->vn, 0);
|
||||
VOP_UNLOCK(be_lun->vn);
|
||||
} else
|
||||
error = EINVAL;
|
||||
if ((cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) &&
|
||||
|
@ -79,7 +79,7 @@ kobj_open_file_vnode(const char *file)
|
||||
return (NULL);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
/* We just unlock so we hold a reference. */
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
return (nd.ni_vp);
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ kobj_get_filesize_vnode(struct _buf *file, uint64_t *size)
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, curthread->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error == 0)
|
||||
*size = (uint64_t)va.va_size;
|
||||
return (error);
|
||||
@ -174,7 +174,7 @@ kobj_read_file_vnode(struct _buf *file, char *buf, unsigned size, unsigned off)
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_READ(vp, &auio, IO_UNIT | IO_SYNC, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (error != 0 ? -1 : size - auio.uio_resid);
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ lookupnameat(char *dirname, enum uio_seg seg, enum symfollow follow,
|
||||
|
||||
vref(startvp);
|
||||
ltype = VOP_ISLOCKED(startvp);
|
||||
VOP_UNLOCK(startvp, 0);
|
||||
VOP_UNLOCK(startvp);
|
||||
NDINIT_ATVP(&nd, LOOKUP, LOCKLEAF | follow, seg, dirname,
|
||||
startvp, curthread);
|
||||
error = namei(&nd);
|
||||
|
@ -154,7 +154,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
|
||||
vput(vp);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/*
|
||||
* Allocate and initialize the filesystem.
|
||||
@ -241,7 +241,7 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
|
||||
vfs_event_signal(NULL, VQ_MOUNT, 0);
|
||||
if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp))
|
||||
panic("mount: lost mount");
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vfs_op_exit(mp);
|
||||
vfs_unbusy(mp);
|
||||
*vpp = mvp;
|
||||
|
@ -185,7 +185,7 @@ vn_openat(char *pnamep, enum uio_seg seg, int filemode, int createmode,
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
if (error == 0) {
|
||||
/* We just unlock so we hold a reference. */
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
*vpp = nd.ni_vp;
|
||||
}
|
||||
return (error);
|
||||
@ -241,7 +241,7 @@ zfs_vop_fsync(vnode_t *vp, int flag, cred_t *cr)
|
||||
goto drop;
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_FSYNC(vp, MNT_WAIT, curthread);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
drop:
|
||||
return (error);
|
||||
|
@ -139,7 +139,7 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
|
||||
vattr.va_mask = AT_SIZE;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, kcred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error) {
|
||||
(void) VOP_CLOSE(vp, spa_mode(vd->vdev_spa), 1, 0, kcred, NULL);
|
||||
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
|
||||
|
@ -721,7 +721,7 @@ zfsctl_root_vptocnp(struct vop_vptocnp_args *ap)
|
||||
if (error != 0)
|
||||
return (SET_ERROR(error));
|
||||
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
*ap->a_vpp = dvp;
|
||||
*ap->a_buflen -= sizeof (dotzfs_name);
|
||||
bcopy(dotzfs_name, ap->a_buf + *ap->a_buflen, sizeof (dotzfs_name));
|
||||
@ -1233,7 +1233,7 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap)
|
||||
/* Look up .zfs/snapshot, our parent. */
|
||||
error = zfsctl_snapdir_vnode(vp->v_mount, NULL, LK_SHARED, &dvp);
|
||||
if (error == 0) {
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
*ap->a_vpp = dvp;
|
||||
*ap->a_buflen -= len;
|
||||
bcopy(node->sn_name, ap->a_buf + *ap->a_buflen, len);
|
||||
|
@ -923,7 +923,7 @@ zfs_get_xattrdir(znode_t *zp, vnode_t **xvpp, cred_t *cr, int flags)
|
||||
goto top;
|
||||
}
|
||||
if (error == 0)
|
||||
VOP_UNLOCK(*xvpp, 0);
|
||||
VOP_UNLOCK(*xvpp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
@ -546,7 +546,7 @@ zfs_replay_create(void *arg1, void *arg2, boolean_t byteswap)
|
||||
default:
|
||||
error = SET_ERROR(ENOTSUP);
|
||||
}
|
||||
VOP_UNLOCK(ZTOV(dzp), 0);
|
||||
VOP_UNLOCK(ZTOV(dzp));
|
||||
|
||||
out:
|
||||
if (error == 0 && vp != NULL)
|
||||
@ -590,7 +590,7 @@ zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap)
|
||||
vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_LOOKUP(ZTOV(dzp), &vp, &cn);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(ZTOV(dzp), 0);
|
||||
VOP_UNLOCK(ZTOV(dzp));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ zfs_replay_remove(void *arg1, void *arg2, boolean_t byteswap)
|
||||
error = SET_ERROR(ENOTSUP);
|
||||
}
|
||||
vput(vp);
|
||||
VOP_UNLOCK(ZTOV(dzp), 0);
|
||||
VOP_UNLOCK(ZTOV(dzp));
|
||||
|
||||
fail:
|
||||
VN_RELE(ZTOV(dzp));
|
||||
@ -646,8 +646,8 @@ zfs_replay_link(void *arg1, void *arg2, boolean_t byteswap)
|
||||
vn_lock(ZTOV(dzp), LK_EXCLUSIVE | LK_RETRY);
|
||||
vn_lock(ZTOV(zp), LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_LINK(ZTOV(dzp), ZTOV(zp), &cn /*,vflg*/);
|
||||
VOP_UNLOCK(ZTOV(zp), 0);
|
||||
VOP_UNLOCK(ZTOV(dzp), 0);
|
||||
VOP_UNLOCK(ZTOV(zp));
|
||||
VOP_UNLOCK(ZTOV(dzp));
|
||||
|
||||
VN_RELE(ZTOV(zp));
|
||||
VN_RELE(ZTOV(dzp));
|
||||
@ -693,10 +693,10 @@ zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap)
|
||||
scn.cn_thread = td;
|
||||
vn_lock(ZTOV(sdzp), LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_LOOKUP(ZTOV(sdzp), &svp, &scn);
|
||||
VOP_UNLOCK(ZTOV(sdzp), 0);
|
||||
VOP_UNLOCK(ZTOV(sdzp));
|
||||
if (error != 0)
|
||||
goto fail;
|
||||
VOP_UNLOCK(svp, 0);
|
||||
VOP_UNLOCK(svp);
|
||||
|
||||
tcn.cn_nameptr = tname;
|
||||
tcn.cn_namelen = strlen(tname);
|
||||
@ -710,7 +710,7 @@ zfs_replay_rename(void *arg1, void *arg2, boolean_t byteswap)
|
||||
if (error == EJUSTRETURN)
|
||||
tvp = NULL;
|
||||
else if (error != 0) {
|
||||
VOP_UNLOCK(ZTOV(tdzp), 0);
|
||||
VOP_UNLOCK(ZTOV(tdzp));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -925,7 +925,7 @@ zfs_replay_setattr(void *arg1, void *arg2, boolean_t byteswap)
|
||||
vp = ZTOV(zp);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_SETATTR(vp, vap, kcred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
zfs_fuid_info_free(zfsvfs->z_fuid_replay);
|
||||
zfsvfs->z_fuid_replay = NULL;
|
||||
@ -966,7 +966,7 @@ zfs_replay_acl_v0(void *arg1, void *arg2, boolean_t byteswap)
|
||||
vp = ZTOV(zp);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = zfs_setsecattr(vp, &vsa, 0, kcred, NULL);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
VN_RELE(vp);
|
||||
|
||||
@ -1030,7 +1030,7 @@ zfs_replay_acl(void *arg1, void *arg2, boolean_t byteswap)
|
||||
vp = ZTOV(zp);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = zfs_setsecattr(vp, &vsa, 0, kcred, NULL);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
if (zfsvfs->z_fuid_replay)
|
||||
zfs_fuid_info_free(zfsvfs->z_fuid_replay);
|
||||
|
@ -305,7 +305,7 @@ zfs_sa_upgrade(sa_handle_t *hdl, dmu_tx_t *tx)
|
||||
|
||||
zp->z_is_sa = B_TRUE;
|
||||
done:
|
||||
VOP_UNLOCK(ZTOV(zp), 0);
|
||||
VOP_UNLOCK(ZTOV(zp));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1855,16 +1855,16 @@ zfs_mount(vfs_t *vfsp)
|
||||
|
||||
vn_lock(mvp, LK_SHARED | LK_RETRY);
|
||||
if (VOP_GETATTR(mvp, &vattr, cr)) {
|
||||
VOP_UNLOCK(mvp, 0);
|
||||
VOP_UNLOCK(mvp);
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (secpolicy_vnode_owner(mvp, cr, vattr.va_uid) != 0 &&
|
||||
VOP_ACCESS(mvp, VWRITE, cr, td) != 0) {
|
||||
VOP_UNLOCK(mvp, 0);
|
||||
VOP_UNLOCK(mvp);
|
||||
goto out;
|
||||
}
|
||||
VOP_UNLOCK(mvp, 0);
|
||||
VOP_UNLOCK(mvp);
|
||||
}
|
||||
|
||||
secpolicy_fs_mount_clearopts(cr, vfsp);
|
||||
|
@ -1569,7 +1569,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, struct componentname *cnp,
|
||||
|
||||
ZFS_EXIT(zfsvfs);
|
||||
ltype = VOP_ISLOCKED(dvp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
error = zfsctl_root(zfsvfs->z_parent, LK_SHARED,
|
||||
&zfsctl_vp);
|
||||
if (error == 0) {
|
||||
@ -3455,9 +3455,9 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
const char *tnm = tcnp->cn_nameptr;
|
||||
int error;
|
||||
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if (*tvpp != NULL && *tvpp != tdvp)
|
||||
VOP_UNLOCK(*tvpp, 0);
|
||||
VOP_UNLOCK(*tvpp);
|
||||
|
||||
relock:
|
||||
error = vn_lock(sdvp, LK_EXCLUSIVE);
|
||||
@ -3467,13 +3467,13 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
|
||||
error = vn_lock(tdvp, LK_EXCLUSIVE | LK_NOWAIT);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(sdvp, 0);
|
||||
VOP_UNLOCK(sdvp);
|
||||
if (error != EBUSY)
|
||||
goto out;
|
||||
error = vn_lock(tdvp, LK_EXCLUSIVE);
|
||||
if (error)
|
||||
goto out;
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(tdvp);
|
||||
goto relock;
|
||||
}
|
||||
tdzp = VTOZ(tdvp);
|
||||
@ -3499,8 +3499,8 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
*/
|
||||
if (tdzp->z_sa_hdl == NULL || sdzp->z_sa_hdl == NULL) {
|
||||
ZFS_EXIT(zfsvfs);
|
||||
VOP_UNLOCK(sdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(sdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
error = SET_ERROR(EIO);
|
||||
goto out;
|
||||
}
|
||||
@ -3513,8 +3513,8 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
if (error != 0) {
|
||||
/* Source entry invalid or not there. */
|
||||
ZFS_EXIT(zfsvfs);
|
||||
VOP_UNLOCK(sdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(sdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if ((scnp->cn_flags & ISDOTDOT) != 0 ||
|
||||
(scnp->cn_namelen == 1 && scnp->cn_nameptr[0] == '.'))
|
||||
error = SET_ERROR(EINVAL);
|
||||
@ -3528,8 +3528,8 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
error = zfs_dirent_lookup(tdzp, tnm, &tzp, 0);
|
||||
if (error != 0) {
|
||||
ZFS_EXIT(zfsvfs);
|
||||
VOP_UNLOCK(sdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(sdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
vrele(svp);
|
||||
if ((tcnp->cn_flags & ISDOTDOT) != 0)
|
||||
error = SET_ERROR(EINVAL);
|
||||
@ -3552,8 +3552,8 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
nvp = svp;
|
||||
error = vn_lock(nvp, LK_EXCLUSIVE | LK_NOWAIT);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(sdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(sdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if (tvp != NULL)
|
||||
vrele(tvp);
|
||||
if (error != EBUSY) {
|
||||
@ -3565,7 +3565,7 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
vrele(nvp);
|
||||
goto out;
|
||||
}
|
||||
VOP_UNLOCK(nvp, 0);
|
||||
VOP_UNLOCK(nvp);
|
||||
/*
|
||||
* Concurrent rename race.
|
||||
* XXX ?
|
||||
@ -3589,9 +3589,9 @@ zfs_rename_relock(struct vnode *sdvp, struct vnode **svpp,
|
||||
nvp = tvp;
|
||||
error = vn_lock(nvp, LK_EXCLUSIVE | LK_NOWAIT);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(sdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(*svpp, 0);
|
||||
VOP_UNLOCK(sdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
VOP_UNLOCK(*svpp);
|
||||
if (error != EBUSY) {
|
||||
vrele(nvp);
|
||||
goto out;
|
||||
@ -3913,17 +3913,17 @@ zfs_rename(vnode_t *sdvp, vnode_t **svpp, struct componentname *scnp,
|
||||
|
||||
unlockout: /* all 4 vnodes are locked, ZFS_ENTER called */
|
||||
ZFS_EXIT(zfsvfs);
|
||||
VOP_UNLOCK(*svpp, 0);
|
||||
VOP_UNLOCK(sdvp, 0);
|
||||
VOP_UNLOCK(*svpp);
|
||||
VOP_UNLOCK(sdvp);
|
||||
|
||||
out: /* original two vnodes are locked */
|
||||
if (error == 0 && zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)
|
||||
zil_commit(zilog, 0);
|
||||
|
||||
if (*tvpp != NULL)
|
||||
VOP_UNLOCK(*tvpp, 0);
|
||||
VOP_UNLOCK(*tvpp);
|
||||
if (tdvp != *tvpp)
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(tdvp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -5505,7 +5505,7 @@ vop_getextattr {
|
||||
} else if (ap->a_uio != NULL)
|
||||
error = VOP_READ(vp, ap->a_uio, IO_UNIT, ap->a_cred);
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_close(vp, flags, ap->a_cred, td);
|
||||
ZFS_EXIT(zfsvfs);
|
||||
|
||||
@ -5640,7 +5640,7 @@ vop_setextattr {
|
||||
if (error == 0)
|
||||
VOP_WRITE(vp, ap->a_uio, IO_UNIT, ap->a_cred);
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_close(vp, flags, ap->a_cred, td);
|
||||
ZFS_EXIT(zfsvfs);
|
||||
|
||||
@ -5903,7 +5903,7 @@ zfs_vptocnp(struct vop_vptocnp_args *ap)
|
||||
covered_vp = vp->v_mount->mnt_vnodecovered;
|
||||
vs = vget_prep(covered_vp);
|
||||
ltype = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = vget_finish(covered_vp, LK_SHARED, vs);
|
||||
if (error == 0) {
|
||||
error = VOP_VPTOCNP(covered_vp, ap->a_vpp, ap->a_cred,
|
||||
|
@ -1272,7 +1272,7 @@ zfs_zget(zfsvfs_t *zfsvfs, uint64_t obj_num, znode_t **zpp)
|
||||
err = insmntque(vp, zfsvfs->z_vfs);
|
||||
if (err == 0) {
|
||||
vp->v_hash = obj_num;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else {
|
||||
zp->z_vnode = NULL;
|
||||
zfs_znode_dmu_fini(zp);
|
||||
|
@ -291,7 +291,7 @@ cloudabi_sys_file_open(struct thread *td,
|
||||
finit(fp, (fflags & FMASK) | (fp->f_flag & FHASLOCK),
|
||||
DTYPE_VNODE, vp, &vnops);
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/* Truncate file. */
|
||||
if (fflags & O_TRUNC) {
|
||||
@ -434,14 +434,14 @@ cloudabi_sys_file_readdir(struct thread *td,
|
||||
/* Validate file type. */
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
if (vp->v_type != VDIR) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = ENOTDIR;
|
||||
goto done;
|
||||
}
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_readdir(td->td_ucred, vp);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
goto done;
|
||||
}
|
||||
#endif /* MAC */
|
||||
@ -451,7 +451,7 @@ cloudabi_sys_file_readdir(struct thread *td,
|
||||
ncookies = 0;
|
||||
error = VOP_READDIR(vp, &readuio, fp->f_cred, &eof,
|
||||
&ncookies, &cookies);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error != 0)
|
||||
goto done;
|
||||
|
||||
|
@ -396,7 +396,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
|
||||
* Lock no longer needed
|
||||
*/
|
||||
locked = false;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/*
|
||||
* Check if file_offset page aligned. Currently we cannot handle
|
||||
@ -469,7 +469,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
|
||||
cleanup:
|
||||
if (opened) {
|
||||
if (locked)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
locked = false;
|
||||
VOP_CLOSE(vp, FREAD, td->td_ucred, td);
|
||||
}
|
||||
@ -481,7 +481,7 @@ linux_uselib(struct thread *td, struct linux_uselib_args *args)
|
||||
VOP_UNSET_TEXT_CHECKED(vp);
|
||||
}
|
||||
if (locked)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/* Release the temporary mapping. */
|
||||
if (a_out)
|
||||
|
@ -1663,7 +1663,7 @@ linux_file_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = vn_stat(vp, sb, td->td_ucred, NOCRED, td);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
@ -2845,7 +2845,7 @@ NdisOpenFile(status, filehandle, filelength, filename, highestaddr)
|
||||
|
||||
/* Get the file size. */
|
||||
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred);
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
|
||||
fh->nf_vp = nd.ni_vp;
|
||||
fh->nf_map = NULL;
|
||||
|
@ -133,12 +133,12 @@ vtblk_rdwr(struct beri_vtblk_softc *sc, struct iovec *iov,
|
||||
if (operation == 0) {
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_READ(vp, &auio, IO_DIRECT, sc->cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else {
|
||||
(void) vn_start_write(vp, &mp, V_WAIT);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_WRITE(vp, &auio, IO_SYNC, sc->cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ close_file(struct beri_vtblk_softc *sc, struct thread *td)
|
||||
if (sc->vnode != NULL) {
|
||||
vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY);
|
||||
sc->vnode->v_vflag &= ~VV_MD;
|
||||
VOP_UNLOCK(sc->vnode, 0);
|
||||
VOP_UNLOCK(sc->vnode);
|
||||
error = vn_close(sc->vnode, (FREAD|FWRITE),
|
||||
sc->cred, td);
|
||||
if (error != 0)
|
||||
@ -263,7 +263,7 @@ open_file(struct beri_vtblk_softc *sc, struct thread *td)
|
||||
}
|
||||
}
|
||||
nd.ni_vp->v_vflag |= VV_MD;
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
|
||||
sc->vnode = nd.ni_vp;
|
||||
sc->cred = crhold(td->td_ucred);
|
||||
|
@ -915,7 +915,7 @@ mdstart_vnode(struct md_s *sc, struct bio *bp)
|
||||
(void) vn_start_write(vp, &mp, V_WAIT);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_FSYNC(vp, MNT_WAIT, td);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
@ -986,13 +986,13 @@ mdstart_vnode(struct md_s *sc, struct bio *bp)
|
||||
if (auio.uio_rw == UIO_READ) {
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_READ(vp, &auio, 0, sc->cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else {
|
||||
(void) vn_start_write(vp, &mp, V_WAIT);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_WRITE(vp, &auio, sc->flags & MD_ASYNC ? 0 : IO_SYNC,
|
||||
sc->cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
if (error == 0)
|
||||
sc->flags &= ~MD_VERIFY;
|
||||
@ -1405,7 +1405,7 @@ mdsetcred(struct md_s *sc, struct ucred *cred)
|
||||
auio.uio_resid = aiov.iov_len;
|
||||
vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_READ(sc->vnode, &auio, 0, sc->cred);
|
||||
VOP_UNLOCK(sc->vnode, 0);
|
||||
VOP_UNLOCK(sc->vnode);
|
||||
free(tmpbuf, M_TEMP);
|
||||
}
|
||||
return (error);
|
||||
@ -1456,7 +1456,7 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td)
|
||||
}
|
||||
}
|
||||
nd.ni_vp->v_vflag |= VV_MD;
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
|
||||
if (mdr->md_fwsectors != 0)
|
||||
sc->fwsectors = mdr->md_fwsectors;
|
||||
@ -1479,7 +1479,7 @@ mdcreate_vnode(struct md_s *sc, struct md_req *mdr, struct thread *td)
|
||||
}
|
||||
return (0);
|
||||
bad:
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
(void)vn_close(nd.ni_vp, flags, td->td_ucred, td);
|
||||
return (error);
|
||||
}
|
||||
@ -1523,7 +1523,7 @@ mddestroy(struct md_s *sc, struct thread *td)
|
||||
if (sc->vnode != NULL) {
|
||||
vn_lock(sc->vnode, LK_EXCLUSIVE | LK_RETRY);
|
||||
sc->vnode->v_vflag &= ~VV_MD;
|
||||
VOP_UNLOCK(sc->vnode, 0);
|
||||
VOP_UNLOCK(sc->vnode);
|
||||
(void)vn_close(sc->vnode, sc->flags & MD_READONLY ?
|
||||
FREAD : (FREAD|FWRITE), sc->cred, td);
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ verifiedexecioctl(struct cdev *dev __unused, u_long cmd, caddr_t data,
|
||||
if (error != 0) {
|
||||
mac_veriexec_set_fingerprint_status(nid.ni_vp,
|
||||
FINGERPRINT_INVALID);
|
||||
VOP_UNLOCK(nid.ni_vp, 0);
|
||||
VOP_UNLOCK(nid.ni_vp);
|
||||
(void) vn_close(nid.ni_vp, FREAD, td->td_ucred,
|
||||
td);
|
||||
return (error);
|
||||
@ -227,7 +227,7 @@ verifiedexecioctl(struct cdev *dev __unused, u_long cmd, caddr_t data,
|
||||
*/
|
||||
mac_veriexec_set_fingerprint_status(nid.ni_vp,
|
||||
FINGERPRINT_INVALID);
|
||||
VOP_UNLOCK(nid.ni_vp, 0);
|
||||
VOP_UNLOCK(nid.ni_vp);
|
||||
(void) vn_close(nid.ni_vp, FREAD, td->td_ucred, td);
|
||||
if (params->flags & VERIEXEC_LABEL)
|
||||
labellen = strnlen(lparams->label,
|
||||
|
@ -2282,7 +2282,7 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist,
|
||||
|
||||
vn_lock(xbb->vn, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_FSYNC(xbb->vn, MNT_WAIT, curthread);
|
||||
VOP_UNLOCK(xbb->vn, 0);
|
||||
VOP_UNLOCK(xbb->vn);
|
||||
|
||||
vn_finished_write(mountpoint);
|
||||
|
||||
@ -2401,7 +2401,7 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist,
|
||||
error = VOP_READ(xbb->vn, &xuio, (flags & BIO_ORDERED) ?
|
||||
(IO_DIRECT|IO_SYNC) : 0, file_data->cred);
|
||||
|
||||
VOP_UNLOCK(xbb->vn, 0);
|
||||
VOP_UNLOCK(xbb->vn);
|
||||
break;
|
||||
case BIO_WRITE: {
|
||||
struct mount *mountpoint;
|
||||
@ -2434,7 +2434,7 @@ xbb_dispatch_file(struct xbb_softc *xbb, struct xbb_xen_reqlist *reqlist,
|
||||
*/
|
||||
error = VOP_WRITE(xbb->vn, &xuio, (flags & BIO_ORDERED) ?
|
||||
IO_SYNC : 0, file_data->cred);
|
||||
VOP_UNLOCK(xbb->vn, 0);
|
||||
VOP_UNLOCK(xbb->vn);
|
||||
|
||||
vn_finished_write(mountpoint);
|
||||
|
||||
@ -2744,7 +2744,7 @@ xbb_open_backend(struct xbb_softc *xbb)
|
||||
xenbus_dev_fatal(xbb->dev, error, "%s is not a disk "
|
||||
"or file", xbb->dev_name);
|
||||
}
|
||||
VOP_UNLOCK(xbb->vn, 0);
|
||||
VOP_UNLOCK(xbb->vn);
|
||||
|
||||
if (error != 0) {
|
||||
xbb_close_backend(xbb);
|
||||
|
@ -152,7 +152,7 @@ autofs_trigger_vn(struct vnode *vp, const char *path, int pathlen,
|
||||
*/
|
||||
lock_flags = VOP_ISLOCKED(vp);
|
||||
vref(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
sx_xlock(&autofs_softc->sc_lock);
|
||||
|
||||
|
@ -235,7 +235,7 @@ iso_mountfs(devvp, mp)
|
||||
if (error == 0)
|
||||
g_getattr("MNT::verified", cp, &isverified);
|
||||
g_topology_unlock();
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
if (error)
|
||||
goto out;
|
||||
if (devvp->v_rdev->si_iosize_max != 0)
|
||||
|
@ -261,11 +261,11 @@ cd9660_ioctl(ap)
|
||||
vp = ap->a_vp;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
if (VN_IS_DOOMED(vp)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (EBADF);
|
||||
}
|
||||
if (vp->v_type == VCHR || vp->v_type == VBLK) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
@ -281,7 +281,7 @@ cd9660_ioctl(ap)
|
||||
break;
|
||||
}
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@ devfs_delete(struct devfs_mount *dm, struct devfs_dirent *de, int flags)
|
||||
VI_UNLOCK(vp);
|
||||
vgone(vp);
|
||||
if ((flags & DEVFS_DEL_VNLOCKED) == 0)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdrop(vp);
|
||||
sx_xlock(&dm->dm_lock);
|
||||
} else
|
||||
|
@ -156,7 +156,7 @@ devfs_mount(struct mount *mp)
|
||||
sx_xunlock(&fmp->dm_lock);
|
||||
}
|
||||
|
||||
VOP_UNLOCK(rvp, 0);
|
||||
VOP_UNLOCK(rvp);
|
||||
vfs_cache_root_set(mp, rvp);
|
||||
|
||||
vfs_mountedfrom(mp, "devfs");
|
||||
|
@ -241,7 +241,7 @@ devfs_populate_vp(struct vnode *vp)
|
||||
DEVFS_DMP_HOLD(dmp);
|
||||
|
||||
/* Can't call devfs_populate() with the vnode lock held. */
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
devfs_populate(dmp);
|
||||
|
||||
sx_xunlock(&dmp->dm_lock);
|
||||
@ -635,7 +635,7 @@ devfs_close(struct vop_close_args *ap)
|
||||
vholdnz(vp);
|
||||
VI_UNLOCK(vp);
|
||||
vp_locked = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
KASSERT(dev->si_refcount > 0,
|
||||
("devfs_close() on un-referenced struct cdev *(%s)", devtoname(dev)));
|
||||
error = dsw->d_close(dev, ap->a_fflag | dflags, S_IFCHR, td);
|
||||
@ -965,7 +965,7 @@ devfs_lookupx(struct vop_lookup_args *ap, int *dm_unlock)
|
||||
if (de == NULL)
|
||||
return (ENOENT);
|
||||
dvplocked = VOP_ISLOCKED(dvp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
error = devfs_allocv(de, mp, cnp->cn_lkflags & LK_TYPE_MASK,
|
||||
vpp);
|
||||
*dm_unlock = 0;
|
||||
@ -1153,7 +1153,7 @@ devfs_open(struct vop_open_args *ap)
|
||||
}
|
||||
|
||||
vlocked = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
fpop = td->td_fpop;
|
||||
td->td_fpop = fp;
|
||||
@ -1464,9 +1464,9 @@ devfs_remove(struct vop_remove_args *ap)
|
||||
de_covered->de_flags &= ~DE_COVERED;
|
||||
}
|
||||
/* We need to unlock dvp because devfs_delete() may lock it. */
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (dvp != vp)
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
devfs_delete(dmp, de, 0);
|
||||
sx_xunlock(&dmp->dm_lock);
|
||||
if (dvp != vp)
|
||||
@ -1507,7 +1507,7 @@ devfs_revoke(struct vop_revoke_args *ap)
|
||||
vgone(vp);
|
||||
vdrop(vp);
|
||||
|
||||
VOP_UNLOCK(vp,0);
|
||||
VOP_UNLOCK(vp);
|
||||
loop:
|
||||
for (;;) {
|
||||
mtx_lock(&devfs_de_interlock);
|
||||
@ -1563,12 +1563,12 @@ devfs_rioctl(struct vop_ioctl_args *ap)
|
||||
vp = ap->a_vp;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
if (VN_IS_DOOMED(vp)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (EBADF);
|
||||
}
|
||||
dmp = VFSTODEVFS(vp->v_mount);
|
||||
sx_xlock(&dmp->dm_lock);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
DEVFS_DMP_HOLD(dmp);
|
||||
devfs_populate(dmp);
|
||||
if (DEVFS_DMP_DROP(dmp)) {
|
||||
|
@ -197,10 +197,10 @@ ext2_mount(struct mount *mp)
|
||||
if (error)
|
||||
error = priv_check(td, PRIV_VFS_MOUNT_PERM);
|
||||
if (error) {
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
g_topology_lock();
|
||||
error = g_access(ump->um_cp, 0, 1, 0);
|
||||
g_topology_unlock();
|
||||
@ -744,7 +744,7 @@ ext2_reload(struct mount *mp, struct thread *td)
|
||||
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (vinvalbuf(devvp, 0, 0, 0) != 0)
|
||||
panic("ext2_reload: dirty1");
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
|
||||
/*
|
||||
* Step 2: re-read superblock from disk.
|
||||
@ -802,7 +802,7 @@ ext2_reload(struct mount *mp, struct thread *td)
|
||||
error = bread(devvp, fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int)fs->e2fs_bsize, NOCRED, &bp);
|
||||
if (error) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vrele(vp);
|
||||
MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
|
||||
return (error);
|
||||
@ -812,7 +812,7 @@ ext2_reload(struct mount *mp, struct thread *td)
|
||||
EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)), ip);
|
||||
|
||||
brelse(bp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vrele(vp);
|
||||
|
||||
if (error) {
|
||||
@ -849,7 +849,7 @@ ext2_mountfs(struct vnode *devvp, struct mount *mp)
|
||||
g_topology_lock();
|
||||
error = g_vfs_open(devvp, &cp, "ext2fs", ronly ? 0 : 1);
|
||||
g_topology_unlock();
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -1155,7 +1155,7 @@ ext2_sync(struct mount *mp, int waitfor)
|
||||
}
|
||||
if ((error = VOP_FSYNC(vp, waitfor, td)) != 0)
|
||||
allerror = error;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vrele(vp);
|
||||
}
|
||||
|
||||
@ -1166,7 +1166,7 @@ ext2_sync(struct mount *mp, int waitfor)
|
||||
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if ((error = VOP_FSYNC(ump->um_devvp, waitfor, td)) != 0)
|
||||
allerror = error;
|
||||
VOP_UNLOCK(ump->um_devvp, 0);
|
||||
VOP_UNLOCK(ump->um_devvp);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -837,13 +837,13 @@ ext2_rename(struct vop_rename_args *ap)
|
||||
ip = VTOI(fvp);
|
||||
if (ip->i_nlink >= EXT4_LINK_MAX &&
|
||||
!EXT2_HAS_RO_COMPAT_FEATURE(ip->i_e2fs, EXT2F_ROCOMPAT_DIR_NLINK)) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
error = EMLINK;
|
||||
goto abortit;
|
||||
}
|
||||
if ((ip->i_flags & (NOUNLINK | IMMUTABLE | APPEND))
|
||||
|| (dp->i_flags & APPEND)) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
error = EPERM;
|
||||
goto abortit;
|
||||
}
|
||||
@ -854,7 +854,7 @@ ext2_rename(struct vop_rename_args *ap)
|
||||
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
|
||||
dp == ip || (fcnp->cn_flags | tcnp->cn_flags) & ISDOTDOT ||
|
||||
(ip->i_flag & IN_RENAME)) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
error = EINVAL;
|
||||
goto abortit;
|
||||
}
|
||||
@ -882,7 +882,7 @@ ext2_rename(struct vop_rename_args *ap)
|
||||
ext2_inc_nlink(ip);
|
||||
ip->i_flag |= IN_CHANGE;
|
||||
if ((error = ext2_update(fvp, !DOINGASYNC(fvp))) != 0) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@ -897,7 +897,7 @@ ext2_rename(struct vop_rename_args *ap)
|
||||
* call to checkpath().
|
||||
*/
|
||||
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
if (oldparent != dp->i_number)
|
||||
newparent = dp->i_number;
|
||||
if (doingdirectory && newparent) {
|
||||
@ -1494,7 +1494,7 @@ ext2_rmdir(struct vop_rmdir_args *ap)
|
||||
ext2_dec_nlink(dp);
|
||||
dp->i_flag |= IN_CHANGE;
|
||||
cache_purge(dvp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
/*
|
||||
* Truncate inode. The only stuff left
|
||||
* in the directory is "." and "..".
|
||||
@ -1504,7 +1504,7 @@ ext2_rmdir(struct vop_rmdir_args *ap)
|
||||
cnp->cn_thread);
|
||||
cache_purge(ITOV(ip));
|
||||
if (vn_lock(dvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ fdesc_mount(struct mount *mp)
|
||||
rvp->v_type = VDIR;
|
||||
rvp->v_vflag |= VV_ROOT;
|
||||
fmp->f_root = rvp;
|
||||
VOP_UNLOCK(rvp, 0);
|
||||
VOP_UNLOCK(rvp);
|
||||
/* XXX -- don't mark as local to work around fts() problems */
|
||||
/*mp->mnt_flag |= MNT_LOCAL;*/
|
||||
vfs_getnewfsid(mp);
|
||||
|
@ -341,7 +341,7 @@ fdesc_lookup(struct vop_lookup_args *ap)
|
||||
* will be re-acquired.
|
||||
*/
|
||||
vhold(dvp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
fdrop(fp, td);
|
||||
|
||||
/* Re-aquire the lock afterwards. */
|
||||
@ -418,7 +418,7 @@ fdesc_pathconf(struct vop_pathconf_args *ap)
|
||||
if (VTOFDESC(vp)->fd_type == Froot)
|
||||
return (vop_stdpathconf(ap));
|
||||
vref(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = kern_fpathconf(curthread, VTOFDESC(vp)->fd_fd,
|
||||
ap->a_name, ap->a_retval);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
@ -516,7 +516,7 @@ fdesc_setattr(struct vop_setattr_args *ap)
|
||||
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) == 0) {
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = VOP_SETATTR(vp, ap->a_vap, ap->a_cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
}
|
||||
fdrop(fp, td);
|
||||
@ -630,7 +630,7 @@ fdesc_readlink(struct vop_readlink_args *va)
|
||||
panic("fdesc_readlink: not fdescfs link");
|
||||
fd_fd = ((struct fdescnode *)vn->v_data)->fd_fd;
|
||||
lockflags = VOP_ISLOCKED(vn);
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
|
||||
td = curthread;
|
||||
error = fget_cap(td, fd_fd, &cap_no_rights, &fp, NULL);
|
||||
|
@ -195,7 +195,7 @@ fifo_open(ap)
|
||||
if ((ap->a_mode & O_NONBLOCK) == 0) {
|
||||
if ((ap->a_mode & FREAD) && fip->fi_writers == 0) {
|
||||
gen = fip->fi_wgen;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
stops_deferred = sigdeferstop(SIGDEFERSTOP_OFF);
|
||||
error = msleep(&fip->fi_readers, PIPE_MTX(fpipe),
|
||||
PDROP | PCATCH | PSOCK, "fifoor", 0);
|
||||
@ -222,7 +222,7 @@ fifo_open(ap)
|
||||
}
|
||||
if ((ap->a_mode & FWRITE) && fip->fi_readers == 0) {
|
||||
gen = fip->fi_rgen;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
stops_deferred = sigdeferstop(SIGDEFERSTOP_OFF);
|
||||
error = msleep(&fip->fi_writers, PIPE_MTX(fpipe),
|
||||
PDROP | PCATCH | PSOCK, "fifoow", 0);
|
||||
|
@ -626,7 +626,7 @@ fuse_vfsop_root(struct mount *mp, int lkflags, struct vnode **vpp)
|
||||
SDT_PROBE2(fusefs, , vfsops, trace, 1,
|
||||
"root vnode race");
|
||||
FUSE_UNLOCK();
|
||||
VOP_UNLOCK(*vpp, 0);
|
||||
VOP_UNLOCK(*vpp);
|
||||
vrele(*vpp);
|
||||
vrecycle(*vpp);
|
||||
*vpp = data->vroot;
|
||||
|
@ -301,10 +301,10 @@ msdosfs_mount(struct mount *mp)
|
||||
if (error)
|
||||
error = priv_check(td, PRIV_VFS_MOUNT_PERM);
|
||||
if (error) {
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
g_topology_lock();
|
||||
error = g_access(pmp->pm_cp, 0, 1, 0);
|
||||
g_topology_unlock();
|
||||
@ -415,7 +415,7 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
|
||||
dev = devvp->v_rdev;
|
||||
if (atomic_cmpset_acq_ptr((uintptr_t *)&dev->si_mountpt, 0,
|
||||
(uintptr_t)mp) == 0) {
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
return (EBUSY);
|
||||
}
|
||||
g_topology_lock();
|
||||
@ -423,12 +423,12 @@ mountmsdosfs(struct vnode *devvp, struct mount *mp)
|
||||
g_topology_unlock();
|
||||
if (error != 0) {
|
||||
atomic_store_rel_ptr((uintptr_t *)&dev->si_mountpt, 0);
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
return (error);
|
||||
}
|
||||
dev_ref(dev);
|
||||
bo = &devvp->v_bufobj;
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
if (dev->si_iosize_max != 0)
|
||||
mp->mnt_iosize_max = dev->si_iosize_max;
|
||||
if (mp->mnt_iosize_max > MAXPHYS)
|
||||
@ -934,7 +934,7 @@ msdosfs_sync(struct mount *mp, int waitfor)
|
||||
error = VOP_FSYNC(vp, waitfor, td);
|
||||
if (error)
|
||||
allerror = error;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vrele(vp);
|
||||
}
|
||||
|
||||
@ -946,7 +946,7 @@ msdosfs_sync(struct mount *mp, int waitfor)
|
||||
error = VOP_FSYNC(pmp->pm_devvp, waitfor, td);
|
||||
if (error)
|
||||
allerror = error;
|
||||
VOP_UNLOCK(pmp->pm_devvp, 0);
|
||||
VOP_UNLOCK(pmp->pm_devvp);
|
||||
}
|
||||
|
||||
error = msdosfs_fsiflush(pmp, waitfor);
|
||||
|
@ -852,7 +852,7 @@ msdosfs_fsync(struct vop_fsync_args *ap)
|
||||
devvp = VTODE(ap->a_vp)->de_pmp->pm_devvp;
|
||||
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
allerror = VOP_FSYNC(devvp, MNT_WAIT, ap->a_td);
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
} else
|
||||
allerror = 0;
|
||||
|
||||
@ -1009,7 +1009,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
(fcnp->cn_flags & ISDOTDOT) ||
|
||||
(tcnp->cn_flags & ISDOTDOT) ||
|
||||
(ip->de_flag & DE_RENAME)) {
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
error = EINVAL;
|
||||
goto abortit;
|
||||
}
|
||||
@ -1040,7 +1040,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
* call to doscheckpath().
|
||||
*/
|
||||
error = VOP_ACCESS(fvp, VWRITE, tcnp->cn_cred, tcnp->cn_thread);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
if (VTODE(fdvp)->de_StartCluster != VTODE(tdvp)->de_StartCluster)
|
||||
newparent = 1;
|
||||
if (doingdirectory && newparent) {
|
||||
@ -1109,7 +1109,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
if ((fcnp->cn_flags & SAVESTART) == 0)
|
||||
panic("msdosfs_rename: lost from startdir");
|
||||
if (!newparent)
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if (relookup(fdvp, &fvp, fcnp) == 0)
|
||||
vrele(fdvp);
|
||||
if (fvp == NULL) {
|
||||
@ -1119,7 +1119,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
if (doingdirectory)
|
||||
panic("rename: lost dir entry");
|
||||
if (newparent)
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(tdvp);
|
||||
vrele(tdvp);
|
||||
vrele(ap->a_fvp);
|
||||
return 0;
|
||||
@ -1139,9 +1139,9 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
if (xp != ip) {
|
||||
if (doingdirectory)
|
||||
panic("rename: lost dir entry");
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
if (newparent)
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
vrele(ap->a_fvp);
|
||||
xp = NULL;
|
||||
} else {
|
||||
@ -1164,8 +1164,8 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
if (error) {
|
||||
memcpy(ip->de_Name, oldname, 11);
|
||||
if (newparent)
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
VOP_UNLOCK(fvp);
|
||||
goto bad;
|
||||
}
|
||||
/*
|
||||
@ -1185,8 +1185,8 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
if (error) {
|
||||
/* XXX should downgrade to ro here, fs is corrupt */
|
||||
if (newparent)
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
VOP_UNLOCK(fvp);
|
||||
goto bad;
|
||||
}
|
||||
if (!doingdirectory) {
|
||||
@ -1195,8 +1195,8 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
if (error) {
|
||||
/* XXX should downgrade to ro here, fs is corrupt */
|
||||
if (newparent)
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
VOP_UNLOCK(fvp);
|
||||
goto bad;
|
||||
}
|
||||
if (ip->de_dirclust == MSDOSFSROOT)
|
||||
@ -1206,7 +1206,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
}
|
||||
reinsert(ip);
|
||||
if (newparent)
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1224,7 +1224,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
NOCRED, &bp);
|
||||
if (error) {
|
||||
/* XXX should downgrade to ro here, fs is corrupt */
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
goto bad;
|
||||
}
|
||||
dotdotp = (struct direntry *)bp->b_data + 1;
|
||||
@ -1238,7 +1238,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
bdwrite(bp);
|
||||
else if ((error = bwrite(bp)) != 0) {
|
||||
/* XXX should downgrade to ro here, fs is corrupt */
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
goto bad;
|
||||
}
|
||||
}
|
||||
@ -1251,7 +1251,7 @@ msdosfs_rename(struct vop_rename_args *ap)
|
||||
* namecache entries that were installed for this direntry.
|
||||
*/
|
||||
cache_purge(fvp);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
bad:
|
||||
if (xp)
|
||||
vput(tvp);
|
||||
|
@ -2550,7 +2550,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);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
} else
|
||||
error = NFSERR_PERM;
|
||||
if (error != 0) {
|
||||
@ -2570,7 +2570,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
|
||||
if (NFSVOPLOCK(vp, LK_SHARED) == 0) {
|
||||
error = VOP_GETEXTATTR(vp, EXTATTR_NAMESPACE_USER,
|
||||
"xxx", NULL, &atsiz, cred, p);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (error != EOPNOTSUPP)
|
||||
xattrsupp = true;
|
||||
}
|
||||
|
@ -1116,7 +1116,7 @@ void nfsd_mntinit(void);
|
||||
* later, for debugging or stats, etc.
|
||||
*/
|
||||
#define NFSVOPLOCK(v, f) vn_lock((v), (f))
|
||||
#define NFSVOPUNLOCK(v, f) VOP_UNLOCK((v), (f))
|
||||
#define NFSVOPUNLOCK(v) VOP_UNLOCK((v))
|
||||
#define NFSVOPISLOCKED(v) VOP_ISLOCKED((v))
|
||||
|
||||
/*
|
||||
|
@ -336,7 +336,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) {
|
||||
NFSVOPUNLOCK(nvp, 0);
|
||||
NFSVOPUNLOCK(nvp);
|
||||
} else if (error == EBUSY) {
|
||||
/*
|
||||
* It is safe so long as a vflush() with
|
||||
|
@ -1624,7 +1624,7 @@ mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam,
|
||||
/*
|
||||
* Lose the lock but keep the ref.
|
||||
*/
|
||||
NFSVOPUNLOCK(*vpp, 0);
|
||||
NFSVOPUNLOCK(*vpp);
|
||||
vfs_cache_root_set(mp, *vpp);
|
||||
return (0);
|
||||
}
|
||||
@ -1826,7 +1826,7 @@ nfs_sync(struct mount *mp, int waitfor)
|
||||
error = VOP_FSYNC(vp, waitfor, td);
|
||||
if (error)
|
||||
allerror = error;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
vrele(vp);
|
||||
}
|
||||
return (allerror);
|
||||
|
@ -353,7 +353,7 @@ nfs_lock(struct vop_lock1_args *ap)
|
||||
* sleepable call to vnode_pager_setsize().
|
||||
*/
|
||||
NFSUNLOCKNODE(np);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (EBUSY);
|
||||
}
|
||||
if ((ap->a_flags & LK_NOWAIT) != 0 ||
|
||||
@ -363,7 +363,7 @@ nfs_lock(struct vop_lock1_args *ap)
|
||||
}
|
||||
if (lktype == LK_SHARED) {
|
||||
NFSUNLOCKNODE(np);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK);
|
||||
ap->a_flags |= LK_EXCLUSIVE;
|
||||
error = VOP_LOCK1_APV(&default_vnodeops, ap);
|
||||
@ -1358,7 +1358,7 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
error = vfs_busy(mp, MBF_NOWAIT);
|
||||
if (error != 0) {
|
||||
vfs_ref(mp);
|
||||
NFSVOPUNLOCK(dvp, 0);
|
||||
NFSVOPUNLOCK(dvp);
|
||||
error = vfs_busy(mp, 0);
|
||||
NFSVOPLOCK(dvp, ltype | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
@ -1369,7 +1369,7 @@ nfs_lookup(struct vop_lookup_args *ap)
|
||||
if (error != 0)
|
||||
return (error);
|
||||
}
|
||||
NFSVOPUNLOCK(dvp, 0);
|
||||
NFSVOPUNLOCK(dvp);
|
||||
error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
|
||||
cnp->cn_lkflags);
|
||||
if (error == 0)
|
||||
@ -1935,7 +1935,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);
|
||||
NFSVOPUNLOCK(fvp, 0);
|
||||
NFSVOPUNLOCK(fvp);
|
||||
if (!error && tvp)
|
||||
error = VOP_FSYNC(tvp, MNT_WAIT, tcnp->cn_thread);
|
||||
if (error)
|
||||
@ -3185,7 +3185,7 @@ 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) {
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
error = nfs_catnap(PZERO | PCATCH, ret,
|
||||
"ncladvl");
|
||||
if (error)
|
||||
@ -3239,13 +3239,13 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
} else if (!NFS_ISV4(vp)) {
|
||||
if ((VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_NOLOCKD) != 0) {
|
||||
size = VTONFS(vp)->n_size;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
error = lf_advlock(ap, &(vp->v_lockf), size);
|
||||
} else {
|
||||
if (nfs_advlock_p != NULL)
|
||||
error = nfs_advlock_p(ap);
|
||||
else {
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
error = ENOLCK;
|
||||
}
|
||||
}
|
||||
@ -3256,14 +3256,14 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
NFSLOCKNODE(np);
|
||||
np->n_flag |= NHASBEENLOCKED;
|
||||
NFSUNLOCKNODE(np);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
}
|
||||
return (error);
|
||||
} else
|
||||
error = EOPNOTSUPP;
|
||||
out:
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -3284,10 +3284,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;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
error = lf_advlockasync(ap, &(vp->v_lockf), size);
|
||||
} else {
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
error = EOPNOTSUPP;
|
||||
}
|
||||
return (error);
|
||||
@ -3667,13 +3667,13 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap)
|
||||
error = vn_lock(invp, LK_SHARED | LK_NOWAIT);
|
||||
if (error == 0)
|
||||
break;
|
||||
VOP_UNLOCK(outvp, 0);
|
||||
VOP_UNLOCK(outvp);
|
||||
if (mp != NULL)
|
||||
vn_finished_write(mp);
|
||||
mp = NULL;
|
||||
error = vn_lock(invp, LK_SHARED);
|
||||
if (error == 0)
|
||||
VOP_UNLOCK(invp, 0);
|
||||
VOP_UNLOCK(invp);
|
||||
}
|
||||
}
|
||||
if (mp != NULL)
|
||||
@ -3802,8 +3802,8 @@ nfs_copy_file_range(struct vop_copy_file_range_args *ap)
|
||||
error = 0;
|
||||
}
|
||||
}
|
||||
VOP_UNLOCK(invp, 0);
|
||||
VOP_UNLOCK(outvp, 0);
|
||||
VOP_UNLOCK(invp);
|
||||
VOP_UNLOCK(outvp);
|
||||
if (mp != NULL)
|
||||
vn_finished_write(mp);
|
||||
if (error == NFSERR_NOTSUPP || error == NFSERR_OFFLOADNOREQS ||
|
||||
@ -3893,7 +3893,7 @@ nfs_ioctl(struct vop_ioctl_args *ap)
|
||||
if (error == 0 && ret != 0)
|
||||
error = ret;
|
||||
}
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
|
||||
if (error != 0)
|
||||
error = ENXIO;
|
||||
|
@ -314,7 +314,7 @@ nfsvno_getattr(struct vnode *vp, struct nfsvattr *nvap,
|
||||
|
||||
error = VOP_GETATTR(vp, &nvap->na_vattr, nd->nd_cred);
|
||||
if (lockedit != 0)
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
|
||||
/*
|
||||
* If we got the Change, Size and Modify Time from the DS,
|
||||
@ -402,7 +402,7 @@ nfsvno_accchk(struct vnode *vp, accmode_t accmode, struct ucred *cred,
|
||||
}
|
||||
if (error != 0) {
|
||||
if (vpislocked == 0)
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ nfsvno_accchk(struct vnode *vp, accmode_t accmode, struct ucred *cred,
|
||||
}
|
||||
}
|
||||
if (vpislocked == 0)
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
|
||||
out:
|
||||
NFSEXITCODE(error);
|
||||
@ -531,7 +531,7 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
goto out1;
|
||||
}
|
||||
if (islocked)
|
||||
NFSVOPUNLOCK(dp, 0);
|
||||
NFSVOPUNLOCK(dp);
|
||||
VREF(dp);
|
||||
*retdirp = dp;
|
||||
if (NFSVNO_EXRDONLY(exp))
|
||||
@ -599,7 +599,7 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0)
|
||||
nfsvno_relpathbuf(ndp);
|
||||
if (ndp->ni_vp && !lockleaf)
|
||||
NFSVOPUNLOCK(ndp->ni_vp, 0);
|
||||
NFSVOPUNLOCK(ndp->ni_vp);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -607,7 +607,7 @@ nfsvno_namei(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
* Validate symlink
|
||||
*/
|
||||
if ((cnp->cn_flags & LOCKPARENT) && ndp->ni_pathlen == 1)
|
||||
NFSVOPUNLOCK(ndp->ni_dvp, 0);
|
||||
NFSVOPUNLOCK(ndp->ni_dvp);
|
||||
if (!(nd->nd_flag & ND_PUBLOOKUP)) {
|
||||
error = EINVAL;
|
||||
goto badlink2;
|
||||
@ -1429,7 +1429,7 @@ nfsvno_rename(struct nameidata *fromndp, struct nameidata *tondp,
|
||||
if (NFSVOPLOCK(fvp, LK_EXCLUSIVE) == 0) {
|
||||
error = nfsrv_checkremove(fvp, 0, NULL,
|
||||
(nfsquad_t)((u_quad_t)0), p);
|
||||
NFSVOPUNLOCK(fvp, 0);
|
||||
NFSVOPUNLOCK(fvp);
|
||||
} else
|
||||
error = EPERM;
|
||||
if (tvp && !error)
|
||||
@ -1515,7 +1515,7 @@ nfsvno_link(struct nameidata *ndp, struct vnode *vp, struct ucred *cred,
|
||||
vrele(ndp->ni_dvp);
|
||||
else
|
||||
vput(ndp->ni_dvp);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
} else {
|
||||
if (ndp->ni_dvp == ndp->ni_vp)
|
||||
vrele(ndp->ni_dvp);
|
||||
@ -2314,7 +2314,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
|
||||
*/
|
||||
mp = vp->v_mount;
|
||||
vfs_ref(mp);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
nd->nd_repstat = vfs_busy(mp, 0);
|
||||
vfs_rel(mp);
|
||||
if (nd->nd_repstat != 0) {
|
||||
@ -2448,8 +2448,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
|
||||
r = VOP_LOOKUP(vp, &nvp,
|
||||
&cn);
|
||||
if (vp != nvp)
|
||||
NFSVOPUNLOCK(vp,
|
||||
0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2563,7 +2562,7 @@ nfsrvd_readdirplus(struct nfsrv_descript *nd, int isdgram,
|
||||
if (nvp != NULL) {
|
||||
supports_nfsv4acls =
|
||||
nfs_supportsnfsv4acls(nvp);
|
||||
NFSVOPUNLOCK(nvp, 0);
|
||||
NFSVOPUNLOCK(nvp);
|
||||
} else
|
||||
supports_nfsv4acls = 0;
|
||||
if (refp != NULL) {
|
||||
@ -3622,7 +3621,7 @@ nfssvc_nfsd(struct thread *td, struct nfssvc_args *uap)
|
||||
if (ret == 0) {
|
||||
nfsrv_dsremove(curdvp, fname,
|
||||
td->td_ucred, td);
|
||||
NFSVOPUNLOCK(curdvp, 0);
|
||||
NFSVOPUNLOCK(curdvp);
|
||||
}
|
||||
}
|
||||
NFSD_DEBUG(4, "nfsrv_copymr=%d\n", error);
|
||||
@ -3898,7 +3897,7 @@ nfsrv_dscreate(struct vnode *dvp, struct vattr *vap, struct vattr *nvap,
|
||||
error = NFSVOPLOCK(dvp, LK_EXCLUSIVE);
|
||||
if (error == 0) {
|
||||
error = VOP_CREATE(dvp, &nvp, &named.ni_cnd, vap);
|
||||
NFSVOPUNLOCK(dvp, 0);
|
||||
NFSVOPUNLOCK(dvp);
|
||||
if (error == 0) {
|
||||
/* Set the ownership of the file. */
|
||||
error = VOP_SETATTR(nvp, nvap, tcred);
|
||||
@ -4286,7 +4285,7 @@ nfsrv_dsremove(struct vnode *dvp, char *fname, struct ucred *tcred,
|
||||
error = VOP_REMOVE(dvp, nvp, &named.ni_cnd);
|
||||
vput(nvp);
|
||||
}
|
||||
NFSVOPUNLOCK(dvp, 0);
|
||||
NFSVOPUNLOCK(dvp);
|
||||
nfsvno_relpathbuf(&named);
|
||||
if (error != 0)
|
||||
printf("pNFS: nfsrv_pnfsremove failed=%d\n", error);
|
||||
@ -4641,7 +4640,7 @@ nfsrv_proxyds(struct vnode *vp, off_t off, int cnt, struct ucred *cred,
|
||||
NFSUNLOCKMNT(failnmp);
|
||||
}
|
||||
for (i = 0; i < mirrorcnt; i++)
|
||||
NFSVOPUNLOCK(dvp[i], 0);
|
||||
NFSVOPUNLOCK(dvp[i]);
|
||||
NFSD_DEBUG(4, "nfsrv_proxyds: aft RPC=%d trya=%d\n", error,
|
||||
trycnt);
|
||||
/* Try the Read/Getattr again if a mirror was deleted. */
|
||||
@ -4826,7 +4825,7 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char *buf, int *buflenp,
|
||||
vput(nvp);
|
||||
}
|
||||
if (error != 0 || lktype == 0)
|
||||
NFSVOPUNLOCK(dvp, 0);
|
||||
NFSVOPUNLOCK(dvp);
|
||||
}
|
||||
}
|
||||
if (error == 0) {
|
||||
@ -4867,7 +4866,7 @@ nfsrv_dsgetsockmnt(struct vnode *vp, int lktype, char *buf, int *buflenp,
|
||||
* have locked dvp's that need to be unlocked.
|
||||
*/
|
||||
for (i = 0; i < gotone; i++) {
|
||||
NFSVOPUNLOCK(*dvpp, 0);
|
||||
NFSVOPUNLOCK(*dvpp);
|
||||
*dvpp++ = NULL;
|
||||
}
|
||||
}
|
||||
@ -6085,7 +6084,7 @@ nfsvno_seek(struct nfsrv_descript *nd, struct vnode *vp, u_long cmd,
|
||||
* VOP_IOCTL() will return ENXIO. However, the correct reply for
|
||||
* NFSv4.2 is *eofp == true and error == 0 for this case.
|
||||
*/
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
error = VOP_IOCTL(vp, cmd, offp, 0, cred, p);
|
||||
*eofp = false;
|
||||
if (error == ENXIO || (error == 0 && cmd == FIOSEEKHOLE)) {
|
||||
|
@ -298,7 +298,7 @@ nfsrvd_getattr(struct nfsrv_descript *nd, int isdgram,
|
||||
} else
|
||||
at_root = 0;
|
||||
vfs_ref(mp);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (at_root != 0) {
|
||||
if ((nd->nd_repstat =
|
||||
NFSVOPLOCK(tvp, LK_SHARED)) == 0) {
|
||||
@ -1409,7 +1409,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
nd->nd_repstat = nfsvno_getattr(vp, &nva, nd, p, 1,
|
||||
NULL);
|
||||
if (vpp != NULL && nd->nd_repstat == 0) {
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
*vpp = vp;
|
||||
} else
|
||||
vput(vp);
|
||||
@ -1584,14 +1584,14 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram,
|
||||
tdp = todp;
|
||||
tnes = *toexp;
|
||||
if (dp != tdp) {
|
||||
NFSVOPUNLOCK(dp, 0);
|
||||
NFSVOPUNLOCK(dp);
|
||||
/* Might lock tdp. */
|
||||
tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd, p, 0,
|
||||
NULL);
|
||||
} else {
|
||||
tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd, p, 1,
|
||||
NULL);
|
||||
NFSVOPUNLOCK(dp, 0);
|
||||
NFSVOPUNLOCK(dp);
|
||||
}
|
||||
} else {
|
||||
tfh.nfsrvfh_len = 0;
|
||||
@ -1613,16 +1613,16 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram,
|
||||
tnes = *exp;
|
||||
tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd, p, 1,
|
||||
NULL);
|
||||
NFSVOPUNLOCK(dp, 0);
|
||||
NFSVOPUNLOCK(dp);
|
||||
} else {
|
||||
NFSVOPUNLOCK(dp, 0);
|
||||
NFSVOPUNLOCK(dp);
|
||||
nd->nd_cred->cr_uid = nd->nd_saveduid;
|
||||
nfsd_fhtovp(nd, &tfh, LK_EXCLUSIVE, &tdp, &tnes, NULL,
|
||||
0); /* Locks tdp. */
|
||||
if (tdp) {
|
||||
tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd,
|
||||
p, 1, NULL);
|
||||
NFSVOPUNLOCK(tdp, 0);
|
||||
NFSVOPUNLOCK(tdp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1729,7 +1729,7 @@ nfsrvd_link(struct nfsrv_descript *nd, int isdgram,
|
||||
nfsrv_wcc(nd, dirfor_ret, &dirfor, diraft_ret, &diraft);
|
||||
goto out;
|
||||
}
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (vnode_vtype(vp) == VDIR) {
|
||||
if (nd->nd_flag & ND_NFSV4)
|
||||
nd->nd_repstat = NFSERR_ISDIR;
|
||||
@ -1751,7 +1751,7 @@ nfsrvd_link(struct nfsrv_descript *nd, int isdgram,
|
||||
}
|
||||
nfsd_fhtovp(nd, &dfh, LK_EXCLUSIVE, &dp, &tnes, NULL, 0);
|
||||
if (dp)
|
||||
NFSVOPUNLOCK(dp, 0);
|
||||
NFSVOPUNLOCK(dp);
|
||||
}
|
||||
}
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE,
|
||||
@ -1908,7 +1908,7 @@ nfsrvd_symlinksub(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
nvap, nd, p, 1, NULL);
|
||||
}
|
||||
if (vpp != NULL && nd->nd_repstat == 0) {
|
||||
NFSVOPUNLOCK(ndp->ni_vp, 0);
|
||||
NFSVOPUNLOCK(ndp->ni_vp);
|
||||
*vpp = ndp->ni_vp;
|
||||
} else
|
||||
vput(ndp->ni_vp);
|
||||
@ -2041,7 +2041,7 @@ nfsrvd_mkdirsub(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
nd->nd_repstat = nfsvno_getattr(vp, nvap, nd, p, 1,
|
||||
NULL);
|
||||
if (vpp && !nd->nd_repstat) {
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
*vpp = vp;
|
||||
} else {
|
||||
vput(vp);
|
||||
@ -3081,7 +3081,7 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
* (ie: Leave the NFSVOPUNLOCK() about here.)
|
||||
*/
|
||||
if (vp)
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (stp)
|
||||
free(stp, M_NFSDSTATE);
|
||||
if (!nd->nd_repstat && dirp)
|
||||
@ -4947,7 +4947,7 @@ nfsrvd_ioadvise(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
!NFSISSET_ATTRBIT(&hints, NFSV4IOHINT_DONTNEED)) ||
|
||||
(NFSISSET_ATTRBIT(&hints, NFSV4IOHINT_DONTNEED) &&
|
||||
!NFSISSET_ATTRBIT(&hints, NFSV4IOHINT_WILLNEED))) {
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (NFSISSET_ATTRBIT(&hints, NFSV4IOHINT_WILLNEED)) {
|
||||
ret = VOP_ADVISE(vp, offset, len, POSIX_FADV_WILLNEED);
|
||||
NFSZERO_ATTRBIT(&hints);
|
||||
@ -5294,7 +5294,7 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
if (nd->nd_repstat == 0)
|
||||
nd->nd_repstat = nfsrv_lockctrl(vp, &instp, &inlop, NULL,
|
||||
clientid, &stateid, exp, nd, curthread);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (nd->nd_repstat != 0)
|
||||
goto out;
|
||||
|
||||
@ -5316,7 +5316,7 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
if (nd->nd_repstat == 0)
|
||||
nd->nd_repstat = nfsrv_lockctrl(tovp, &outstp, &outlop, NULL,
|
||||
clientid, &stateid, toexp, nd, curthread);
|
||||
NFSVOPUNLOCK(tovp, 0);
|
||||
NFSVOPUNLOCK(tovp);
|
||||
|
||||
/* Range lock the byte ranges for both invp and outvp. */
|
||||
if (nd->nd_repstat == 0) {
|
||||
@ -5372,7 +5372,7 @@ nfsrvd_copy_file_range(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
nd->nd_repstat = NFSERR_INVAL;
|
||||
}
|
||||
}
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (ret != 0 && nd->nd_repstat == 0)
|
||||
nd->nd_repstat = ret;
|
||||
} else if (nd->nd_repstat == 0)
|
||||
|
@ -624,7 +624,7 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen,
|
||||
|
||||
if (nfs_retfh[nd->nd_procnum] == 1) {
|
||||
if (vp)
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
error = (*(nfsrv3_procs1[nd->nd_procnum]))(nd, isdgram,
|
||||
vp, NULL, (fhandle_t *)fh.nfsrvfh_data, &nes);
|
||||
} else if (nfs_retfh[nd->nd_procnum] == 2) {
|
||||
@ -934,7 +934,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
|
||||
vrele(vp);
|
||||
vp = nvp;
|
||||
cur_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
vpnes = nes;
|
||||
}
|
||||
break;
|
||||
@ -949,7 +949,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
|
||||
vrele(vp);
|
||||
vp = nvp;
|
||||
cur_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
vpnes = nes;
|
||||
}
|
||||
break;
|
||||
@ -962,7 +962,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
|
||||
vrele(vp);
|
||||
vp = nvp;
|
||||
cur_fsid = vp->v_mount->mnt_stat.f_fsid;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
vpnes = nes;
|
||||
}
|
||||
} else
|
||||
@ -1079,7 +1079,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
|
||||
}
|
||||
}
|
||||
/* Lookup ops return a locked vnode */
|
||||
NFSVOPUNLOCK(nvp, 0);
|
||||
NFSVOPUNLOCK(nvp);
|
||||
}
|
||||
if (!nd->nd_repstat) {
|
||||
vrele(vp);
|
||||
|
@ -1554,7 +1554,7 @@ nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp, int cansleep,
|
||||
tvp = NULL;
|
||||
else if (vp == NULL && cansleep != 0) {
|
||||
tvp = nfsvno_getvp(&lfp->lf_fh);
|
||||
NFSVOPUNLOCK(tvp, 0);
|
||||
NFSVOPUNLOCK(tvp);
|
||||
} else
|
||||
tvp = vp;
|
||||
gottvp = 1;
|
||||
@ -1780,7 +1780,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
|
||||
if (vnode_unlocked == 0) {
|
||||
ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl1");
|
||||
vnode_unlocked = 1;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
reterr = nfsrv_locallock(vp, lfp,
|
||||
(new_lop->lo_flags & (NFSLCK_READ | NFSLCK_WRITE)),
|
||||
@ -1954,7 +1954,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
|
||||
if (vnode_unlocked == 0) {
|
||||
ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl2");
|
||||
vnode_unlocked = 1;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
nfsrv_locallock_rollback(vp, lfp, p);
|
||||
NFSLOCKSTATE();
|
||||
@ -2038,7 +2038,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
|
||||
ASSERT_VOP_ELOCKED(vp,
|
||||
"nfsrv_lockctrl3");
|
||||
vnode_unlocked = 1;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
nfsrv_locallock_rollback(vp, lfp, p);
|
||||
NFSLOCKSTATE();
|
||||
@ -2150,7 +2150,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
|
||||
NFSUNLOCKSTATE();
|
||||
if (vnode_unlocked == 0) {
|
||||
ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl4");
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
nfsrv_locallock_rollback(vp, lfp, p);
|
||||
NFSLOCKSTATE();
|
||||
@ -2205,7 +2205,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
|
||||
if (vnode_unlocked == 0) {
|
||||
ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl5");
|
||||
vnode_unlocked = 1;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
/* Update the local locks. */
|
||||
nfsrv_localunlock(vp, lfp, first, end, p);
|
||||
@ -2247,7 +2247,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
|
||||
if (filestruct_locked != 0) {
|
||||
if (vnode_unlocked == 0) {
|
||||
ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl6");
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
/* Roll back local locks. */
|
||||
nfsrv_locallock_rollback(vp, lfp, p);
|
||||
@ -2296,7 +2296,7 @@ nfsrv_lockctrl(vnode_t vp, struct nfsstate **new_stpp,
|
||||
if (vnode_unlocked == 0) {
|
||||
ASSERT_VOP_ELOCKED(vp, "nfsrv_lockctrl7");
|
||||
vnode_unlocked = 1;
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
nfsrv_locallock_rollback(vp, lfp, p);
|
||||
NFSLOCKSTATE();
|
||||
@ -3525,7 +3525,7 @@ nfsrv_openupdate(vnode_t vp, struct nfsstate *new_stp, nfsquad_t clientid,
|
||||
nfsrv_locklf(lfp);
|
||||
NFSUNLOCKSTATE();
|
||||
ASSERT_VOP_ELOCKED(vp, "nfsrv_openupdate");
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
if (nfsrv_freeopen(stp, vp, 1, p) == 0) {
|
||||
NFSLOCKSTATE();
|
||||
nfsrv_unlocklf(lfp);
|
||||
@ -4979,7 +4979,7 @@ nfsrv_updatestable(NFSPROC_T *p)
|
||||
if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) {
|
||||
error = nfsvno_setattr(vp, &nva, NFSFPCRED(sf->nsf_fp), p,
|
||||
NULL);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
} else
|
||||
error = EPERM;
|
||||
vn_finished_write(mp);
|
||||
@ -5156,7 +5156,7 @@ nfsrv_clientconflict(struct nfsclient *clp, int *haslockp, vnode_t vp,
|
||||
NFSUNLOCKSTATE();
|
||||
if (vp != NULL) {
|
||||
lktype = NFSVOPISLOCKED(vp);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
NFSLOCKV4ROOTMUTEX();
|
||||
nfsv4_relref(&nfsv4rootfs_lock);
|
||||
@ -5331,7 +5331,7 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p,
|
||||
NFSUNLOCKSTATE();
|
||||
if (vp != NULL) {
|
||||
lktype = NFSVOPISLOCKED(vp);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
}
|
||||
NFSLOCKV4ROOTMUTEX();
|
||||
nfsv4_relref(&nfsv4rootfs_lock);
|
||||
@ -5566,7 +5566,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPROC_T *p)
|
||||
if (NFSVOPLOCK(vp, LK_EXCLUSIVE) == 0) {
|
||||
error = nfsrv_checkremove(vp, 0, NULL,
|
||||
(nfsquad_t)((u_quad_t)0), p);
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
} else
|
||||
error = EPERM;
|
||||
if (error == NFSERR_DELAY) {
|
||||
@ -7600,7 +7600,7 @@ nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p,
|
||||
M_NFSDSTATE, M_WAITOK | M_ZERO);
|
||||
ds->nfsdev_dvp = nd.ni_vp;
|
||||
ds->nfsdev_nmp = VFSTONFS(nd.ni_vp->v_mount);
|
||||
NFSVOPUNLOCK(nd.ni_vp, 0);
|
||||
NFSVOPUNLOCK(nd.ni_vp);
|
||||
|
||||
dsdirsize = strlen(dspathp) + 16;
|
||||
dsdirpath = malloc(dsdirsize, M_TEMP, M_WAITOK);
|
||||
@ -7626,7 +7626,7 @@ nfsrv_setdsserver(char *dspathp, char *mdspathp, NFSPROC_T *p,
|
||||
break;
|
||||
}
|
||||
ds->nfsdev_dsdir[i] = nd.ni_vp;
|
||||
NFSVOPUNLOCK(nd.ni_vp, 0);
|
||||
NFSVOPUNLOCK(nd.ni_vp);
|
||||
}
|
||||
free(dsdirpath, M_TEMP);
|
||||
|
||||
@ -8241,7 +8241,7 @@ nfsrv_copymr(vnode_t vp, vnode_t fvp, vnode_t dvp, struct nfsdevice *ds,
|
||||
didprintf = 0;
|
||||
TAILQ_INIT(&thl);
|
||||
/* Unlock the MDS vp, so that a LayoutReturn can be done on it. */
|
||||
NFSVOPUNLOCK(vp, 0);
|
||||
NFSVOPUNLOCK(vp);
|
||||
/* Now, do a recall for all layouts not yet recalled. */
|
||||
tryagain:
|
||||
NFSDRECALLLOCK();
|
||||
|
@ -113,7 +113,7 @@ nullfs_mount(struct mount *mp)
|
||||
*/
|
||||
if (mp->mnt_vnodecovered->v_op == &null_vnodeops &&
|
||||
VOP_ISLOCKED(mp->mnt_vnodecovered) == LK_EXCLUSIVE) {
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered);
|
||||
isvnunlocked = true;
|
||||
} else {
|
||||
isvnunlocked = false;
|
||||
@ -186,7 +186,7 @@ nullfs_mount(struct mount *mp)
|
||||
/*
|
||||
* Unlock the node (either the lower or the alias)
|
||||
*/
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
if (NULLVPTOLOWERVP(nullm_rootvp)->v_mount->mnt_flag & MNT_LOCAL) {
|
||||
MNT_ILOCK(mp);
|
||||
@ -444,7 +444,7 @@ nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp)
|
||||
*/
|
||||
KASSERT(VN_IS_DOOMED(vp),
|
||||
("not reclaimed nullfs vnode %p", vp));
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else {
|
||||
/*
|
||||
* Otherwise, the nullfs vnode still shares the lock
|
||||
|
@ -410,7 +410,7 @@ null_lookup(struct vop_lookup_args *ap)
|
||||
* ldvp and locking dvp, which is also correct if the
|
||||
* locks are still shared.
|
||||
*/
|
||||
VOP_UNLOCK(ldvp, 0);
|
||||
VOP_UNLOCK(ldvp);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
}
|
||||
vdrop(ldvp);
|
||||
@ -690,7 +690,7 @@ null_lock(struct vop_lock1_args *ap)
|
||||
panic("Unsupported lock request %d\n",
|
||||
ap->a_flags);
|
||||
}
|
||||
VOP_UNLOCK(lvp, 0);
|
||||
VOP_UNLOCK(lvp);
|
||||
error = vop_stdlock(ap);
|
||||
}
|
||||
vdrop(lvp);
|
||||
@ -718,7 +718,7 @@ null_unlock(struct vop_unlock_args *ap)
|
||||
nn = VTONULL(vp);
|
||||
if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) {
|
||||
vholdnz(lvp);
|
||||
error = VOP_UNLOCK(lvp, 0);
|
||||
error = VOP_UNLOCK(lvp);
|
||||
vdrop(lvp);
|
||||
} else {
|
||||
error = vop_stdunlock(ap);
|
||||
@ -884,7 +884,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
|
||||
vhold(lvp);
|
||||
mp = vp->v_mount;
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vp, 0); /* vp is held by vn_vptocnp_locked that called us */
|
||||
VOP_UNLOCK(vp); /* vp is held by vn_vptocnp_locked that called us */
|
||||
ldvp = lvp;
|
||||
vref(lvp);
|
||||
error = vn_vptocnp(&ldvp, cred, ap->a_buf, ap->a_buflen);
|
||||
@ -907,7 +907,7 @@ null_vptocnp(struct vop_vptocnp_args *ap)
|
||||
#ifdef DIAGNOSTIC
|
||||
NULLVPTOLOWERVP(*dvp);
|
||||
#endif
|
||||
VOP_UNLOCK(*dvp, 0); /* keep reference on *dvp */
|
||||
VOP_UNLOCK(*dvp); /* keep reference on *dvp */
|
||||
}
|
||||
vn_lock(vp, locked | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
|
@ -291,7 +291,7 @@ pfs_purge_one(struct vnode *vnp)
|
||||
|
||||
VOP_LOCK(vnp, LK_EXCLUSIVE);
|
||||
vgone(vnp);
|
||||
VOP_UNLOCK(vnp, 0);
|
||||
VOP_UNLOCK(vnp);
|
||||
vdrop(vnp);
|
||||
}
|
||||
|
||||
|
@ -291,7 +291,7 @@ pfs_ioctl(struct vop_ioctl_args *va)
|
||||
vn = va->a_vp;
|
||||
vn_lock(vn, LK_SHARED | LK_RETRY);
|
||||
if (VN_IS_DOOMED(vn)) {
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
return (EBADF);
|
||||
}
|
||||
pvd = vn->v_data;
|
||||
@ -301,13 +301,13 @@ pfs_ioctl(struct vop_ioctl_args *va)
|
||||
pfs_assert_not_owned(pn);
|
||||
|
||||
if (vn->v_type != VREG) {
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
PFS_RETURN (EINVAL);
|
||||
}
|
||||
KASSERT_PN_IS_FILE(pn);
|
||||
|
||||
if (pn->pn_ioctl == NULL) {
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
PFS_RETURN (ENOTTY);
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ pfs_ioctl(struct vop_ioctl_args *va)
|
||||
* have changed since the open() call.
|
||||
*/
|
||||
if (!pfs_visible(curthread, pn, pvd->pvd_pid, &proc)) {
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
PFS_RETURN (EIO);
|
||||
}
|
||||
|
||||
@ -325,7 +325,7 @@ pfs_ioctl(struct vop_ioctl_args *va)
|
||||
if (proc != NULL)
|
||||
PROC_UNLOCK(proc);
|
||||
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
PFS_RETURN (error);
|
||||
}
|
||||
|
||||
@ -422,7 +422,7 @@ pfs_vptocnp(struct vop_vptocnp_args *ap)
|
||||
* vp is held by caller.
|
||||
*/
|
||||
locked = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
error = pfs_vncache_alloc(mp, dvp, pn, pid);
|
||||
if (error) {
|
||||
@ -432,7 +432,7 @@ pfs_vptocnp(struct vop_vptocnp_args *ap)
|
||||
}
|
||||
|
||||
*buflen = i;
|
||||
VOP_UNLOCK(*dvp, 0);
|
||||
VOP_UNLOCK(*dvp);
|
||||
vn_lock(vp, locked | LK_RETRY);
|
||||
vfs_unbusy(mp);
|
||||
|
||||
@ -506,7 +506,7 @@ pfs_lookup(struct vop_cachedlookup_args *va)
|
||||
error = vfs_busy(mp, MBF_NOWAIT);
|
||||
if (error != 0) {
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
error = vfs_busy(mp, 0);
|
||||
vn_lock(vn, LK_EXCLUSIVE | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
@ -517,7 +517,7 @@ pfs_lookup(struct vop_cachedlookup_args *va)
|
||||
PFS_RETURN(ENOENT);
|
||||
}
|
||||
}
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
KASSERT(pd->pn_parent != NULL,
|
||||
("%s(): non-root directory has no parent", __func__));
|
||||
/*
|
||||
@ -666,7 +666,7 @@ pfs_read(struct vop_read_args *va)
|
||||
|
||||
vhold(vn);
|
||||
locked = VOP_ISLOCKED(vn);
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
|
||||
if (pn->pn_flags & PFS_RAWRD) {
|
||||
PFS_TRACE(("%zd resid", uio->uio_resid));
|
||||
@ -944,7 +944,7 @@ pfs_readlink(struct vop_readlink_args *va)
|
||||
}
|
||||
vhold(vn);
|
||||
locked = VOP_ISLOCKED(vn);
|
||||
VOP_UNLOCK(vn, 0);
|
||||
VOP_UNLOCK(vn);
|
||||
|
||||
/* sbuf_new() can't fail with a static buffer */
|
||||
sbuf_new(&sb, buf, sizeof buf, 0);
|
||||
|
@ -234,7 +234,7 @@ smbfs_mount(struct mount *mp)
|
||||
vfs_mount_error(mp, "smbfs_root error: %d", error);
|
||||
goto bad;
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
SMBVDEBUG("root.v_usecount = %d\n", vrefcnt(vp));
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
|
@ -1338,7 +1338,7 @@ smbfs_lookup(ap)
|
||||
error = vfs_busy(mp, MBF_NOWAIT);
|
||||
if (error != 0) {
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
error = vfs_busy(mp, 0);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
@ -1352,7 +1352,7 @@ smbfs_lookup(ap)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
error = smbfs_nget(mp, dvp, name, nmlen, NULL, &vp);
|
||||
vfs_unbusy(mp);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
|
@ -374,7 +374,7 @@ tmpfs_mount(struct mount *mp)
|
||||
|
||||
vn_lock(mp->mnt_vnodecovered, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(mp->mnt_vnodecovered, &va, mp->mnt_cred);
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
|
@ -674,9 +674,9 @@ tmpfs_rename_relock(struct vnode *fdvp, struct vnode **fvpp,
|
||||
struct tmpfs_dirent *de;
|
||||
int error, restarts = 0;
|
||||
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if (*tvpp != NULL && *tvpp != tdvp)
|
||||
VOP_UNLOCK(*tvpp, 0);
|
||||
VOP_UNLOCK(*tvpp);
|
||||
mp = fdvp->v_mount;
|
||||
|
||||
relock:
|
||||
@ -685,11 +685,11 @@ tmpfs_rename_relock(struct vnode *fdvp, struct vnode **fvpp,
|
||||
if (error)
|
||||
goto releout;
|
||||
if (vn_lock(tdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) {
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
error = vn_lock(tdvp, LK_EXCLUSIVE);
|
||||
if (error)
|
||||
goto releout;
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(tdvp);
|
||||
goto relock;
|
||||
}
|
||||
/*
|
||||
@ -698,8 +698,8 @@ tmpfs_rename_relock(struct vnode *fdvp, struct vnode **fvpp,
|
||||
*/
|
||||
de = tmpfs_dir_lookup(VP_TO_TMPFS_DIR(fdvp), NULL, fcnp);
|
||||
if (de == NULL) {
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if ((fcnp->cn_flags & ISDOTDOT) != 0 ||
|
||||
(fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.'))
|
||||
error = EINVAL;
|
||||
@ -709,14 +709,14 @@ tmpfs_rename_relock(struct vnode *fdvp, struct vnode **fvpp,
|
||||
}
|
||||
error = tmpfs_alloc_vp(mp, de->td_node, LK_EXCLUSIVE | LK_NOWAIT, &nvp);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if (error != EBUSY)
|
||||
goto releout;
|
||||
error = tmpfs_alloc_vp(mp, de->td_node, LK_EXCLUSIVE, &nvp);
|
||||
if (error != 0)
|
||||
goto releout;
|
||||
VOP_UNLOCK(nvp, 0);
|
||||
VOP_UNLOCK(nvp);
|
||||
/*
|
||||
* Concurrent rename race.
|
||||
*/
|
||||
@ -731,7 +731,7 @@ tmpfs_rename_relock(struct vnode *fdvp, struct vnode **fvpp,
|
||||
}
|
||||
vrele(*fvpp);
|
||||
*fvpp = nvp;
|
||||
VOP_UNLOCK(*fvpp, 0);
|
||||
VOP_UNLOCK(*fvpp);
|
||||
/*
|
||||
* Re-resolve tvp and acquire the vnode lock if present.
|
||||
*/
|
||||
@ -755,15 +755,15 @@ tmpfs_rename_relock(struct vnode *fdvp, struct vnode **fvpp,
|
||||
vrele(*tvpp);
|
||||
*tvpp = nvp;
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(tdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
VOP_UNLOCK(tdvp);
|
||||
if (error != EBUSY)
|
||||
goto releout;
|
||||
error = tmpfs_alloc_vp(mp, de->td_node, LK_EXCLUSIVE,
|
||||
&nvp);
|
||||
if (error != 0)
|
||||
goto releout;
|
||||
VOP_UNLOCK(nvp, 0);
|
||||
VOP_UNLOCK(nvp);
|
||||
/*
|
||||
* fdvp contains fvp, thus tvp (=fdvp) is not empty.
|
||||
*/
|
||||
@ -1062,7 +1062,7 @@ tmpfs_rename(struct vop_rename_args *v)
|
||||
|
||||
out_locked:
|
||||
if (fdvp != tdvp && fdvp != tvp)
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
|
||||
out:
|
||||
/*
|
||||
@ -1513,7 +1513,7 @@ tmpfs_vptocnp_fill(struct vnode *vp, struct tmpfs_node *tn,
|
||||
}
|
||||
if (error == 0) {
|
||||
if (vp != *dvp)
|
||||
VOP_UNLOCK(*dvp, 0);
|
||||
VOP_UNLOCK(*dvp);
|
||||
} else {
|
||||
if (vp != *dvp)
|
||||
vput(*dvp);
|
||||
|
@ -330,7 +330,7 @@ udf_mountfs(struct vnode *devvp, struct mount *mp)
|
||||
g_topology_lock();
|
||||
error = g_vfs_open(devvp, &cp, "udf", 0);
|
||||
g_topology_unlock();
|
||||
VOP_UNLOCK(devvp, 0);
|
||||
VOP_UNLOCK(devvp);
|
||||
if (error)
|
||||
goto bail;
|
||||
|
||||
|
@ -361,9 +361,9 @@ unionfs_noderem(struct vnode *vp, struct thread *td)
|
||||
VI_UNLOCK(vp);
|
||||
|
||||
if (lvp != NULLVP)
|
||||
VOP_UNLOCK(lvp, 0);
|
||||
VOP_UNLOCK(lvp);
|
||||
if (uvp != NULLVP)
|
||||
VOP_UNLOCK(uvp, 0);
|
||||
VOP_UNLOCK(uvp);
|
||||
|
||||
if (dvp != NULLVP && unp->un_hash.le_prev != NULL)
|
||||
unionfs_rem_cached_vnode(unp, dvp);
|
||||
@ -551,7 +551,7 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
|
||||
cn->cn_flags |= NOCACHE;
|
||||
|
||||
vref(dvp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
|
||||
if ((error = relookup(dvp, vpp, cn))) {
|
||||
uma_zfree(namei_zone, cn->cn_pnbuf);
|
||||
@ -961,7 +961,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp,
|
||||
}
|
||||
|
||||
unionfs_vn_create_on_upper_free_out1:
|
||||
VOP_UNLOCK(udvp, 0);
|
||||
VOP_UNLOCK(udvp);
|
||||
|
||||
unionfs_vn_create_on_upper_free_out2:
|
||||
if (cn.cn_flags & HASBUF) {
|
||||
|
@ -167,7 +167,7 @@ unionfs_domount(struct mount *mp)
|
||||
uid = va.va_uid;
|
||||
gid = va.va_gid;
|
||||
}
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
@ -252,7 +252,7 @@ unionfs_domount(struct mount *mp)
|
||||
* Save reference
|
||||
*/
|
||||
if (below) {
|
||||
VOP_UNLOCK(upperrootvp, 0);
|
||||
VOP_UNLOCK(upperrootvp);
|
||||
vn_lock(lowerrootvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
ump->um_lowervp = upperrootvp;
|
||||
ump->um_uppervp = lowerrootvp;
|
||||
@ -278,7 +278,7 @@ unionfs_domount(struct mount *mp)
|
||||
/*
|
||||
* Unlock the node
|
||||
*/
|
||||
VOP_UNLOCK(ump->um_uppervp, 0);
|
||||
VOP_UNLOCK(ump->um_uppervp);
|
||||
|
||||
/*
|
||||
* Get the unionfs root vnode.
|
||||
|
@ -128,7 +128,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
if (udvp != NULLVP) {
|
||||
dtmpvp = udvp;
|
||||
if (ldvp != NULLVP)
|
||||
VOP_UNLOCK(ldvp, 0);
|
||||
VOP_UNLOCK(ldvp);
|
||||
}
|
||||
else
|
||||
dtmpvp = ldvp;
|
||||
@ -136,7 +136,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
error = VOP_LOOKUP(dtmpvp, &vp, cnp);
|
||||
|
||||
if (dtmpvp == udvp && ldvp != NULLVP) {
|
||||
VOP_UNLOCK(udvp, 0);
|
||||
VOP_UNLOCK(udvp);
|
||||
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
}
|
||||
|
||||
@ -148,10 +148,10 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
*/
|
||||
if (nameiop == DELETE || nameiop == RENAME ||
|
||||
(cnp->cn_lkflags & LK_TYPE_MASK))
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vrele(vp);
|
||||
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
*(ap->a_vpp) = dunp->un_dvp;
|
||||
vref(dunp->un_dvp);
|
||||
|
||||
@ -188,7 +188,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
}
|
||||
if (nameiop == DELETE || nameiop == RENAME ||
|
||||
(cnp->cn_lkflags & LK_TYPE_MASK))
|
||||
VOP_UNLOCK(uvp, 0);
|
||||
VOP_UNLOCK(uvp);
|
||||
}
|
||||
|
||||
/* check whiteout */
|
||||
@ -232,7 +232,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
return (lerror);
|
||||
}
|
||||
if (cnp->cn_lkflags & LK_TYPE_MASK)
|
||||
VOP_UNLOCK(lvp, 0);
|
||||
VOP_UNLOCK(lvp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,7 +267,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
goto unionfs_lookup_out;
|
||||
|
||||
if (LK_SHARED == (cnp->cn_lkflags & LK_TYPE_MASK))
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (LK_EXCLUSIVE != VOP_ISLOCKED(vp)) {
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
lockflag = 1;
|
||||
@ -275,7 +275,7 @@ unionfs_lookup(struct vop_cachedlookup_args *ap)
|
||||
error = unionfs_mkshadowdir(MOUNTTOUNIONFSMOUNT(dvp->v_mount),
|
||||
udvp, VTOUNIONFS(vp), cnp, td);
|
||||
if (lockflag != 0)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error != 0) {
|
||||
UNIONFSDEBUG("unionfs_lookup: Unable to create shadow dir.");
|
||||
if ((cnp->cn_lkflags & LK_TYPE_MASK) == LK_EXCLUSIVE)
|
||||
@ -372,7 +372,7 @@ unionfs_create(struct vop_create_args *ap)
|
||||
if (vp->v_type == VSOCK)
|
||||
*(ap->a_vpp) = vp;
|
||||
else {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP,
|
||||
ap->a_dvp, ap->a_vpp, cnp, curthread);
|
||||
vrele(vp);
|
||||
@ -446,7 +446,7 @@ unionfs_mknod(struct vop_mknod_args *ap)
|
||||
if (vp->v_type == VSOCK)
|
||||
*(ap->a_vpp) = vp;
|
||||
else {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP,
|
||||
ap->a_dvp, ap->a_vpp, cnp, curthread);
|
||||
vrele(vp);
|
||||
@ -903,7 +903,7 @@ unionfs_ioctl(struct vop_ioctl_args *ap)
|
||||
unionfs_get_node_status(unp, ap->a_td, &unsp);
|
||||
ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp);
|
||||
unionfs_tryrem_node_status(unp, unsp);
|
||||
VOP_UNLOCK(ap->a_vp, 0);
|
||||
VOP_UNLOCK(ap->a_vp);
|
||||
|
||||
if (ovp == NULLVP)
|
||||
return (EBADF);
|
||||
@ -930,7 +930,7 @@ unionfs_poll(struct vop_poll_args *ap)
|
||||
unionfs_get_node_status(unp, ap->a_td, &unsp);
|
||||
ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp);
|
||||
unionfs_tryrem_node_status(unp, unsp);
|
||||
VOP_UNLOCK(ap->a_vp, 0);
|
||||
VOP_UNLOCK(ap->a_vp);
|
||||
|
||||
if (ovp == NULLVP)
|
||||
return (EBADF);
|
||||
@ -990,7 +990,7 @@ unionfs_remove(struct vop_remove_args *ap)
|
||||
ump = NULL;
|
||||
vp = uvp = lvp = NULLVP;
|
||||
/* search vnode */
|
||||
VOP_UNLOCK(ap->a_vp, 0);
|
||||
VOP_UNLOCK(ap->a_vp);
|
||||
error = unionfs_relookup(udvp, &vp, cnp, &cn, td,
|
||||
cnp->cn_nameptr, strlen(cnp->cn_nameptr), DELETE);
|
||||
if (error != 0 && error != ENOENT) {
|
||||
@ -1193,7 +1193,7 @@ unionfs_rename(struct vop_rename_args *ap)
|
||||
if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0)
|
||||
goto unionfs_rename_abort;
|
||||
error = unionfs_copyfile(unp, 1, fcnp->cn_cred, td);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
if (error != 0)
|
||||
goto unionfs_rename_abort;
|
||||
break;
|
||||
@ -1201,7 +1201,7 @@ unionfs_rename(struct vop_rename_args *ap)
|
||||
if ((error = vn_lock(fvp, LK_EXCLUSIVE)) != 0)
|
||||
goto unionfs_rename_abort;
|
||||
error = unionfs_mkshadowdir(ump, rfdvp, unp, fcnp, td);
|
||||
VOP_UNLOCK(fvp, 0);
|
||||
VOP_UNLOCK(fvp);
|
||||
if (error != 0)
|
||||
goto unionfs_rename_abort;
|
||||
break;
|
||||
@ -1258,13 +1258,13 @@ unionfs_rename(struct vop_rename_args *ap)
|
||||
if ((error = vn_lock(fdvp, LK_EXCLUSIVE)) != 0)
|
||||
goto unionfs_rename_abort;
|
||||
error = unionfs_relookup_for_delete(fdvp, fcnp, td);
|
||||
VOP_UNLOCK(fdvp, 0);
|
||||
VOP_UNLOCK(fdvp);
|
||||
if (error != 0)
|
||||
goto unionfs_rename_abort;
|
||||
|
||||
/* Locke of tvp is canceled in order to avoid recursive lock. */
|
||||
if (tvp != NULLVP && tvp != tdvp)
|
||||
VOP_UNLOCK(tvp, 0);
|
||||
VOP_UNLOCK(tvp);
|
||||
error = unionfs_relookup_for_rename(tdvp, tcnp, td);
|
||||
if (tvp != NULLVP && tvp != tdvp)
|
||||
vn_lock(tvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
@ -1282,11 +1282,11 @@ unionfs_rename(struct vop_rename_args *ap)
|
||||
}
|
||||
|
||||
if (ltdvp != NULLVP)
|
||||
VOP_UNLOCK(ltdvp, 0);
|
||||
VOP_UNLOCK(ltdvp);
|
||||
if (tdvp != rtdvp)
|
||||
vrele(tdvp);
|
||||
if (ltvp != NULLVP)
|
||||
VOP_UNLOCK(ltvp, 0);
|
||||
VOP_UNLOCK(ltvp);
|
||||
if (tvp != rtvp && tvp != NULLVP) {
|
||||
if (rtvp == NULLVP)
|
||||
vput(tvp);
|
||||
@ -1360,7 +1360,7 @@ unionfs_mkdir(struct vop_mkdir_args *ap)
|
||||
}
|
||||
|
||||
if ((error = VOP_MKDIR(udvp, &uvp, cnp, ap->a_vap)) == 0) {
|
||||
VOP_UNLOCK(uvp, 0);
|
||||
VOP_UNLOCK(uvp);
|
||||
cnp->cn_lkflags = LK_EXCLUSIVE;
|
||||
error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP,
|
||||
ap->a_dvp, ap->a_vpp, cnp, td);
|
||||
@ -1458,7 +1458,7 @@ unionfs_symlink(struct vop_symlink_args *ap)
|
||||
if (udvp != NULLVP) {
|
||||
error = VOP_SYMLINK(udvp, &uvp, cnp, ap->a_vap, ap->a_target);
|
||||
if (error == 0) {
|
||||
VOP_UNLOCK(uvp, 0);
|
||||
VOP_UNLOCK(uvp);
|
||||
cnp->cn_lkflags = LK_EXCLUSIVE;
|
||||
error = unionfs_nodeget(ap->a_dvp->v_mount, uvp, NULLVP,
|
||||
ap->a_dvp, ap->a_vpp, cnp, td);
|
||||
@ -1884,12 +1884,12 @@ unionfs_lock(struct vop_lock1_args *ap)
|
||||
/* Share Lock is once released and a deadlock is avoided. */
|
||||
vholdnz(uvp);
|
||||
uhold = 1;
|
||||
VOP_UNLOCK(uvp, 0);
|
||||
VOP_UNLOCK(uvp);
|
||||
unp = VTOUNIONFS(vp);
|
||||
if (unp == NULL) {
|
||||
/* vnode is released. */
|
||||
VI_UNLOCK(vp);
|
||||
VOP_UNLOCK(lvp, 0);
|
||||
VOP_UNLOCK(lvp);
|
||||
vdrop(uvp);
|
||||
return (EBUSY);
|
||||
}
|
||||
@ -1909,7 +1909,7 @@ unionfs_lock(struct vop_lock1_args *ap)
|
||||
/* vnode is released. */
|
||||
VI_UNLOCK(vp);
|
||||
if (error == 0)
|
||||
VOP_UNLOCK(lvp, 0);
|
||||
VOP_UNLOCK(lvp);
|
||||
vdrop(lvp);
|
||||
if (uhold != 0)
|
||||
vdrop(uvp);
|
||||
@ -1940,10 +1940,10 @@ unionfs_lock(struct vop_lock1_args *ap)
|
||||
/* vnode is released. */
|
||||
VI_UNLOCK(vp);
|
||||
if (error == 0)
|
||||
VOP_UNLOCK(uvp, 0);
|
||||
VOP_UNLOCK(uvp);
|
||||
vdrop(uvp);
|
||||
if (lvp != NULLVP) {
|
||||
VOP_UNLOCK(lvp, 0);
|
||||
VOP_UNLOCK(lvp);
|
||||
vdrop(lvp);
|
||||
}
|
||||
return (vop_stdlock(ap));
|
||||
@ -1994,13 +1994,13 @@ unionfs_unlock(struct vop_unlock_args *ap)
|
||||
|
||||
if (lvp != NULLVP) {
|
||||
vholdnz(lvp);
|
||||
error = VOP_UNLOCK(lvp, 0);
|
||||
error = VOP_UNLOCK(lvp);
|
||||
}
|
||||
|
||||
if (error == 0 && uvp != NULLVP) {
|
||||
vholdnz(uvp);
|
||||
uhold = 1;
|
||||
error = VOP_UNLOCK(uvp, 0);
|
||||
error = VOP_UNLOCK(uvp);
|
||||
}
|
||||
|
||||
if (lvp != NULLVP)
|
||||
@ -2070,7 +2070,7 @@ unionfs_advlock(struct vop_advlock_args *ap)
|
||||
unionfs_tryrem_node_status(unp, unsp);
|
||||
}
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
error = VOP_ADVLOCK(uvp, ap->a_id, ap->a_op, ap->a_fl, ap->a_flags);
|
||||
|
||||
@ -2079,7 +2079,7 @@ unionfs_advlock(struct vop_advlock_args *ap)
|
||||
return error;
|
||||
|
||||
unionfs_advlock_abort:
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
UNIONFS_INTERNAL_DEBUG("unionfs_advlock: leave (%d)\n", error);
|
||||
|
||||
|
@ -115,7 +115,7 @@ exec_linux_imgact(struct image_params *imgp)
|
||||
}
|
||||
PROC_UNLOCK(imgp->proc);
|
||||
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
|
||||
/*
|
||||
* Destroy old process VM and create a new one (with a new stack)
|
||||
|
@ -262,7 +262,7 @@ exec_aout_imgact(struct image_params *imgp)
|
||||
* However, in cases where the vnode lock is external, such as nullfs,
|
||||
* v_usecount may become zero.
|
||||
*/
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
|
||||
/*
|
||||
* Destroy old process VM and create a new one (with a new stack)
|
||||
|
@ -557,7 +557,7 @@ __elfN(map_insert)(struct image_params *imgp, vm_map_t map, vm_object_t object,
|
||||
(object != NULL ? MAP_VN_EXEC : 0));
|
||||
if (rv != KERN_SUCCESS) {
|
||||
locked = VOP_ISLOCKED(imgp->vp);
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
vm_object_deallocate(object);
|
||||
vn_lock(imgp->vp, locked | LK_RETRY);
|
||||
return (rv);
|
||||
@ -968,7 +968,7 @@ __elfN(get_interp)(struct image_params *imgp, const Elf_Phdr *phdr,
|
||||
*/
|
||||
interp = malloc(interp_name_len + 1, M_TEMP, M_NOWAIT);
|
||||
if (interp == NULL) {
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK);
|
||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
|
||||
}
|
||||
@ -1188,7 +1188,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
* The VV_TEXT flag prevents modifications to the executable while
|
||||
* the vnode is unlocked.
|
||||
*/
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
|
||||
/*
|
||||
* Decide whether to enable randomization of user mappings.
|
||||
@ -1272,7 +1272,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
imgp->entry_addr = entry;
|
||||
|
||||
if (interp != NULL) {
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
if ((map->flags & MAP_ASLR) != 0) {
|
||||
/* Assume that interpeter fits into 1/4 of AS */
|
||||
maxv1 = maxv / 2 + addr / 2;
|
||||
@ -1293,7 +1293,7 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp)
|
||||
*/
|
||||
elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_NOWAIT);
|
||||
if (elf_auxargs == NULL) {
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
elf_auxargs = malloc(sizeof(Elf_Auxargs), M_TEMP, M_WAITOK);
|
||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
|
||||
}
|
||||
@ -2566,7 +2566,7 @@ __elfN(parse_notes)(struct image_params *imgp, Elf_Note *checknote,
|
||||
pnote->p_filesz > PAGE_SIZE - pnote->p_offset) {
|
||||
buf = malloc(pnote->p_filesz, M_TEMP, M_NOWAIT);
|
||||
if (buf == NULL) {
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
buf = malloc(pnote->p_filesz, M_TEMP, M_WAITOK);
|
||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
|
||||
}
|
||||
|
@ -226,12 +226,12 @@ sys_acct(struct thread *td, struct acct_args *uap)
|
||||
#ifdef MAC
|
||||
error = mac_system_check_acct(td->td_ucred, nd.ni_vp);
|
||||
if (error) {
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
vn_close(nd.ni_vp, flags, td->td_ucred, td);
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
if (nd.ni_vp->v_type != VREG) {
|
||||
vn_close(nd.ni_vp, flags, td->td_ucred, td);
|
||||
return (EACCES);
|
||||
|
@ -376,7 +376,7 @@ alq_doio(struct alq *alq)
|
||||
if (mac_vnode_check_write(alq->aq_cred, NOCRED, vp) == 0)
|
||||
#endif
|
||||
VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, alq->aq_cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
|
||||
ALQ_LOCK(alq);
|
||||
@ -453,7 +453,7 @@ alq_open_flags(struct alq **alqp, const char *file, struct ucred *cred, int cmod
|
||||
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
/* We just unlock so we hold a reference */
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
|
||||
alq = malloc(sizeof(*alq), M_ALD, M_WAITOK|M_ZERO);
|
||||
alq->aq_vp = nd.ni_vp;
|
||||
|
@ -293,7 +293,7 @@ link_elf_ctf_get(linker_file_t lf, linker_ctf_t *lc)
|
||||
lc->typlenp = &ef->typlen;
|
||||
|
||||
out:
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
||||
|
||||
if (hdr != NULL)
|
||||
|
@ -812,7 +812,7 @@ kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg)
|
||||
} else {
|
||||
atomic_clear_int(&fp->f_flag, FRDAHEAD);
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
fdrop(fp, td);
|
||||
break;
|
||||
|
||||
@ -1483,7 +1483,7 @@ kern_fpathconf(struct thread *td, int fd, int name, long *valuep)
|
||||
if (vp != NULL) {
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_PATHCONF(vp, name, valuep);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else if (fp->f_type == DTYPE_PIPE || fp->f_type == DTYPE_SOCKET) {
|
||||
if (name != _PC_PIPE_BUF) {
|
||||
error = EINVAL;
|
||||
|
@ -523,7 +523,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
(imgp->vp->v_mount->mnt_flag & MNT_NOSUID) == 0 &&
|
||||
(p->p_flag & P_TRACED) == 0) {
|
||||
imgp->credential_setid = true;
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
imgp->newcred = crdup(oldcred);
|
||||
if (attr.va_mode & S_ISUID) {
|
||||
euip = uifind(attr.va_uid);
|
||||
@ -556,7 +556,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
*/
|
||||
if (oldcred->cr_svuid != oldcred->cr_uid ||
|
||||
oldcred->cr_svgid != oldcred->cr_gid) {
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
imgp->newcred = crdup(oldcred);
|
||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
|
||||
change_svuid(imgp->newcred, imgp->newcred->cr_uid);
|
||||
@ -571,7 +571,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
if (args->fname != NULL && args->fname[0] == '/')
|
||||
imgp->execpath = args->fname;
|
||||
else {
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
if (vn_fullpath(td, imgp->vp, &imgp->execpath,
|
||||
&imgp->freepath) != 0)
|
||||
imgp->execpath = args->fname;
|
||||
@ -654,7 +654,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
* NB: We unlock the vnode here because it is believed that none
|
||||
* of the sv_copyout_strings/sv_fixup operations require the vnode.
|
||||
*/
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
|
||||
if (disallow_high_osrel &&
|
||||
P_OSREL_MAJOR(p->p_osrel) > P_OSREL_MAJOR(__FreeBSD_version)) {
|
||||
@ -787,7 +787,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
* taking sleepable locks, so temporarily drop our locks.
|
||||
*/
|
||||
PROC_UNLOCK(p);
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
fdsetugidsafety(td);
|
||||
error = fdcheckstd(td);
|
||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY);
|
||||
@ -858,7 +858,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
* P_INEXEC flag is cleared.
|
||||
*/
|
||||
if (PMC_SYSTEM_SAMPLING_ACTIVE() || PMC_PROC_IS_USING_PMCS(p)) {
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
pe.pm_credentialschanged = credential_changing;
|
||||
pe.pm_entryaddr = imgp->entry_addr;
|
||||
|
||||
@ -893,7 +893,7 @@ do_execve(struct thread *td, struct image_args *args, struct mac *mac_p)
|
||||
if (error != 0)
|
||||
vput(imgp->vp);
|
||||
else
|
||||
VOP_UNLOCK(imgp->vp, 0);
|
||||
VOP_UNLOCK(imgp->vp);
|
||||
}
|
||||
|
||||
if (imgp->object != NULL)
|
||||
|
@ -939,7 +939,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, int flags)
|
||||
vput(root);
|
||||
goto done_free;
|
||||
}
|
||||
VOP_UNLOCK(root, 0);
|
||||
VOP_UNLOCK(root);
|
||||
if (fullpath_disabled) {
|
||||
/* Leave room for a real-root full pathname. */
|
||||
if (len + (path[0] == '/' && strcmp(mypr->pr_path, "/")
|
||||
@ -2393,7 +2393,7 @@ do_jail_attach(struct thread *td, struct prison *pr)
|
||||
if ((error = mac_vnode_check_chroot(td->td_ucred, pr->pr_root)))
|
||||
goto e_unlock;
|
||||
#endif
|
||||
VOP_UNLOCK(pr->pr_root, 0);
|
||||
VOP_UNLOCK(pr->pr_root);
|
||||
if ((error = pwd_chroot(td, pr->pr_root)))
|
||||
goto e_revert_osd;
|
||||
|
||||
@ -2417,7 +2417,7 @@ do_jail_attach(struct thread *td, struct prison *pr)
|
||||
return (0);
|
||||
|
||||
e_unlock:
|
||||
VOP_UNLOCK(pr->pr_root, 0);
|
||||
VOP_UNLOCK(pr->pr_root);
|
||||
e_revert_osd:
|
||||
/* Tell modules this thread is still in its old jail after all. */
|
||||
(void)osd_jail_call(td->td_ucred->cr_prison, PR_METHOD_ATTACH, td);
|
||||
|
@ -941,7 +941,7 @@ sys_ktrace(struct thread *td, struct ktrace_args *uap)
|
||||
}
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
vp = nd.ni_vp;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (vp->v_type != VREG) {
|
||||
(void) vn_close(vp, FREAD|FWRITE, td->td_ucred, td);
|
||||
ktrace_exit(td);
|
||||
@ -1242,7 +1242,7 @@ ktr_writerequest(struct thread *td, struct ktr_request *req)
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_WRITE(vp, &auio, IO_UNIT | IO_APPEND, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
crfree(cred);
|
||||
if (!error) {
|
||||
|
@ -1813,7 +1813,7 @@ linker_lookup_file(const char *path, int pathlen, const char *name,
|
||||
type = nd.ni_vp->v_type;
|
||||
if (vap)
|
||||
VOP_GETATTR(nd.ni_vp, vap, td->td_ucred);
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
||||
if (type == VREG)
|
||||
return (result);
|
||||
@ -1878,7 +1878,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
|
||||
UIO_SYSSPACE, IO_NODELOCKED, cred, NOCRED, &reclen, td);
|
||||
if (error)
|
||||
goto bad;
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
vn_close(nd.ni_vp, FREAD, cred, td);
|
||||
nd.ni_vp = NULL;
|
||||
if (reclen != 0) {
|
||||
@ -1946,7 +1946,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
|
||||
if (hints)
|
||||
free(hints, M_TEMP);
|
||||
if (nd.ni_vp != NULL) {
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
vn_close(nd.ni_vp, FREAD, cred, td);
|
||||
}
|
||||
/*
|
||||
|
@ -871,7 +871,7 @@ killjobc(void)
|
||||
sx_xunlock(&proctree_lock);
|
||||
if (vn_lock(ttyvp, LK_EXCLUSIVE) == 0) {
|
||||
VOP_REVOKE(ttyvp, REVOKEALL);
|
||||
VOP_UNLOCK(ttyvp, 0);
|
||||
VOP_UNLOCK(ttyvp);
|
||||
}
|
||||
vrele(ttyvp);
|
||||
sx_xlock(&proctree_lock);
|
||||
|
@ -544,7 +544,7 @@ sendfile_getobj(struct thread *td, struct file *fp, vm_object_t *obj_res,
|
||||
|
||||
out:
|
||||
if (vp != NULL)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -764,7 +764,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
|
||||
goto done;
|
||||
error = VOP_GETATTR(vp, &va, td->td_ucred);
|
||||
if (error != 0 || off >= va.va_size) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
goto done;
|
||||
}
|
||||
if (va.va_size != obj_size) {
|
||||
@ -830,7 +830,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
|
||||
rhpages, flags);
|
||||
if (error != 0) {
|
||||
if (vp != NULL)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
sfio->m = NULL;
|
||||
sendfile_iodone(sfio, NULL, 0, error);
|
||||
goto done;
|
||||
@ -1011,7 +1011,7 @@ vn_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio,
|
||||
}
|
||||
|
||||
if (vp != NULL)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/* Keep track of bytes processed. */
|
||||
off += space;
|
||||
|
@ -510,21 +510,21 @@ kern_reroot(void)
|
||||
error = vfs_busy(mp, MBF_NOWAIT);
|
||||
if (error != 0) {
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = vfs_busy(mp, 0);
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (ENOENT);
|
||||
}
|
||||
if (VN_IS_DOOMED(vp)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vfs_unbusy(mp);
|
||||
return (ENOENT);
|
||||
}
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/*
|
||||
* Remove the filesystem containing currently-running executable
|
||||
|
@ -3372,7 +3372,7 @@ static void
|
||||
vnode_close_locked(struct thread *td, struct vnode *vp)
|
||||
{
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_close(vp, FWRITE, td->td_ucred, td);
|
||||
}
|
||||
|
||||
@ -3655,12 +3655,12 @@ coredump(struct thread *td)
|
||||
if (vp->v_type != VREG || VOP_GETATTR(vp, &vattr, cred) != 0 ||
|
||||
vattr.va_nlink != 1 || (vp->v_vflag & VV_SYSTEM) != 0 ||
|
||||
vattr.va_uid != cred->cr_uid) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = EFAULT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/* Postpone other writers, including core dumps of other processes. */
|
||||
rl_cookie = vn_rangelock_wlock(vp, 0, OFF_MAX);
|
||||
@ -3677,7 +3677,7 @@ coredump(struct thread *td)
|
||||
vattr.va_flags = UF_NODUMP;
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
VOP_SETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
PROC_LOCK(p);
|
||||
p->p_acflag |= ACORE;
|
||||
PROC_UNLOCK(p);
|
||||
|
@ -1168,7 +1168,7 @@ link_elf_load_file(linker_class_t cls, const char* filename,
|
||||
#endif
|
||||
link_elf_reloc_local(lf);
|
||||
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
error = linker_load_dependencies(lf);
|
||||
vn_lock(nd.ni_vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (error != 0)
|
||||
@ -1285,7 +1285,7 @@ link_elf_load_file(linker_class_t cls, const char* filename,
|
||||
*result = lf;
|
||||
|
||||
out:
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
||||
if (error != 0 && lf != NULL)
|
||||
linker_file_unload(lf, LINKER_UNLOAD_FORCE);
|
||||
|
@ -1135,7 +1135,7 @@ link_elf_load_file(linker_class_t cls, const char *filename,
|
||||
goto out;
|
||||
|
||||
/* Pull in dependencies */
|
||||
VOP_UNLOCK(nd->ni_vp, 0);
|
||||
VOP_UNLOCK(nd->ni_vp);
|
||||
error = linker_load_dependencies(lf);
|
||||
vn_lock(nd->ni_vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (error)
|
||||
@ -1163,7 +1163,7 @@ link_elf_load_file(linker_class_t cls, const char *filename,
|
||||
*result = lf;
|
||||
|
||||
out:
|
||||
VOP_UNLOCK(nd->ni_vp, 0);
|
||||
VOP_UNLOCK(nd->ni_vp);
|
||||
vn_close(nd->ni_vp, FREAD, td->td_ucred, td);
|
||||
free(nd, M_TEMP);
|
||||
if (error && lf)
|
||||
|
@ -725,7 +725,7 @@ do_recycle(void *context, int pending __unused)
|
||||
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
vrecycle(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdrop(vp);
|
||||
}
|
||||
|
||||
@ -893,7 +893,7 @@ mqfs_lookupx(struct vop_cachedlookup_args *ap)
|
||||
return (EIO);
|
||||
if ((flags & ISLASTCN) && nameiop != LOOKUP)
|
||||
return (EINVAL);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
KASSERT(pd->mn_parent, ("non-root directory has no parent"));
|
||||
pn = pd->mn_parent;
|
||||
error = mqfs_allocv(dvp->v_mount, vpp, pn);
|
||||
|
@ -654,7 +654,7 @@ uipc_bindat(int fd, struct socket *so, struct sockaddr *nam, struct thread *td)
|
||||
unp->unp_addr = soun;
|
||||
unp->unp_flags &= ~UNP_BINDING;
|
||||
UNP_PCB_UNLOCK(unp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
free(buf, M_TEMP);
|
||||
return (0);
|
||||
|
@ -253,7 +253,7 @@ vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type,
|
||||
#ifdef MAC
|
||||
out_unlock:
|
||||
#endif
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
out:
|
||||
acl_free(inkernelacl);
|
||||
@ -285,7 +285,7 @@ vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type,
|
||||
#ifdef MAC
|
||||
out:
|
||||
#endif
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error == 0)
|
||||
error = acl_copyout(inkernelacl, aclp, type);
|
||||
acl_free(inkernelacl);
|
||||
@ -316,7 +316,7 @@ vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type)
|
||||
#ifdef MAC
|
||||
out:
|
||||
#endif
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
|
@ -733,7 +733,7 @@ aio_fsync_vnode(struct thread *td, struct vnode *vp)
|
||||
}
|
||||
error = VOP_FSYNC(vp, MNT_WAIT, td);
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
drop:
|
||||
return (error);
|
||||
|
@ -3554,7 +3554,7 @@ flushbufqueues(struct vnode *lvp, struct bufdomain *bd, int target,
|
||||
}
|
||||
vn_finished_write(mp);
|
||||
if (unlock)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
flushwithdeps += hasdeps;
|
||||
flushed++;
|
||||
|
||||
|
@ -1394,7 +1394,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp,
|
||||
ltype = 0; /* silence gcc warning */
|
||||
if (cnp->cn_flags & ISDOTDOT) {
|
||||
ltype = VOP_ISLOCKED(dvp);
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
}
|
||||
vs = vget_prep(*vpp);
|
||||
cache_lookup_unlock(blp, dvlp);
|
||||
@ -2562,7 +2562,7 @@ vn_path_to_global_path(struct thread *td, struct vnode *vp, char *path,
|
||||
return (ENODEV);
|
||||
|
||||
/* Construct global filesystem path from vp. */
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = vn_fullpath_global(td, vp, &rpath, &fbuf);
|
||||
|
||||
if (error != 0) {
|
||||
|
@ -420,7 +420,7 @@ vop_stdadvlock(struct vop_advlock_args *ap)
|
||||
*/
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
return (error);
|
||||
} else
|
||||
@ -441,7 +441,7 @@ vop_stdadvlockasync(struct vop_advlockasync_args *ap)
|
||||
/* The size argument is only needed for SEEK_END. */
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, curthread->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
return (error);
|
||||
} else
|
||||
@ -522,15 +522,11 @@ int
|
||||
vop_stdunlock(ap)
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct mtx *ilk;
|
||||
|
||||
ilk = VI_MTX(vp);
|
||||
return (lockmgr_unlock_fast_path(vp->v_vnlock, ap->a_flags,
|
||||
&ilk->lock_object));
|
||||
return (lockmgr_unlock_fast_path(vp->v_vnlock, 0, NULL));
|
||||
}
|
||||
|
||||
/* See above. */
|
||||
@ -585,13 +581,11 @@ int
|
||||
vop_unlock(ap)
|
||||
struct vop_unlock_args /* {
|
||||
struct vnode *a_vp;
|
||||
int a_flags;
|
||||
} */ *ap;
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
|
||||
MPASS(vp->v_vnlock == &vp->v_lock);
|
||||
MPASS(ap->a_flags == 0);
|
||||
|
||||
return (lockmgr_unlock(&vp->v_lock));
|
||||
}
|
||||
@ -835,7 +829,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap)
|
||||
|
||||
VREF(vp);
|
||||
locked = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
NDINIT_ATVP(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE,
|
||||
"..", vp, td);
|
||||
flags = FREAD;
|
||||
@ -853,7 +847,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap)
|
||||
((*dvp)->v_mount->mnt_flag & MNT_UNION)) {
|
||||
*dvp = (*dvp)->v_mount->mnt_vnodecovered;
|
||||
VREF(mvp);
|
||||
VOP_UNLOCK(mvp, 0);
|
||||
VOP_UNLOCK(mvp);
|
||||
vn_close(mvp, FREAD, cred, td);
|
||||
VREF(*dvp);
|
||||
vn_lock(*dvp, LK_SHARED | LK_RETRY);
|
||||
@ -884,15 +878,15 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap)
|
||||
if ((dp->d_type != DT_WHT) &&
|
||||
(dp->d_fileno == fileno)) {
|
||||
if (covered) {
|
||||
VOP_UNLOCK(*dvp, 0);
|
||||
VOP_UNLOCK(*dvp);
|
||||
vn_lock(mvp, LK_SHARED | LK_RETRY);
|
||||
if (dirent_exists(mvp, dp->d_name, td)) {
|
||||
error = ENOENT;
|
||||
VOP_UNLOCK(mvp, 0);
|
||||
VOP_UNLOCK(mvp);
|
||||
vn_lock(*dvp, LK_SHARED | LK_RETRY);
|
||||
goto out;
|
||||
}
|
||||
VOP_UNLOCK(mvp, 0);
|
||||
VOP_UNLOCK(mvp);
|
||||
vn_lock(*dvp, LK_SHARED | LK_RETRY);
|
||||
}
|
||||
i -= dp->d_namlen;
|
||||
@ -922,7 +916,7 @@ vop_stdvptocnp(struct vop_vptocnp_args *ap)
|
||||
vput(*dvp);
|
||||
vrele(mvp);
|
||||
} else {
|
||||
VOP_UNLOCK(mvp, 0);
|
||||
VOP_UNLOCK(mvp);
|
||||
vn_close(mvp, FREAD, cred, td);
|
||||
}
|
||||
vn_lock(vp, locked | LK_RETRY);
|
||||
@ -1085,7 +1079,7 @@ vop_stdadvise(struct vop_advise_args *ap)
|
||||
error = 0;
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (VN_IS_DOOMED(vp)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1125,7 +1119,7 @@ vop_stdadvise(struct vop_advise_args *ap)
|
||||
if (error == 0)
|
||||
error = bnoreuselist(&bo->bo_dirty, bo, startn, endn);
|
||||
BO_RUNLOCK(bo);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
break;
|
||||
default:
|
||||
error = EINVAL;
|
||||
@ -1275,7 +1269,7 @@ vop_stdioctl(struct vop_ioctl_args *ap)
|
||||
else if (ap->a_command == FIOSEEKHOLE)
|
||||
*offp = va.va_size;
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
break;
|
||||
default:
|
||||
error = ENOTTY;
|
||||
@ -1423,7 +1417,7 @@ vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname)
|
||||
{
|
||||
|
||||
if (filename_vp != NULL)
|
||||
VOP_UNLOCK(filename_vp, 0);
|
||||
VOP_UNLOCK(filename_vp);
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
||||
|
@ -124,7 +124,7 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
|
||||
mp = NULL;
|
||||
goto out;
|
||||
}
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
error = vn_start_write(nd.ni_vp, &mp_writable, V_WAIT | PCATCH);
|
||||
NDFREE(&nd, NDF_NO_VP_UNLOCK);
|
||||
if (error)
|
||||
@ -213,7 +213,7 @@ extattr_set_vp(struct vnode *vp, int attrnamespace, const char *attrname,
|
||||
#ifdef MAC
|
||||
done:
|
||||
#endif
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
@ -381,7 +381,7 @@ extattr_get_vp(struct vnode *vp, int attrnamespace, const char *attrname,
|
||||
#ifdef MAC
|
||||
done:
|
||||
#endif
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (error);
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ extattr_delete_vp(struct vnode *vp, int attrnamespace, const char *attrname,
|
||||
#ifdef MAC
|
||||
done:
|
||||
#endif
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
@ -656,14 +656,14 @@ extattr_list_vp(struct vnode *vp, int attrnamespace, void *data,
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_listextattr(td->td_ucred, vp, attrnamespace);
|
||||
if (error) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (error);
|
||||
}
|
||||
#endif
|
||||
|
||||
error = VOP_LISTEXTATTR(vp, attrnamespace, auiop, sizep,
|
||||
td->td_ucred, td);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
if (auiop != NULL) {
|
||||
cnt -= auio.uio_resid;
|
||||
|
@ -119,14 +119,10 @@ crossmp_vop_unlock(struct vop_unlock_args *ap)
|
||||
{
|
||||
struct vnode *vp;
|
||||
struct lock *lk __unused;
|
||||
int flags;
|
||||
|
||||
vp = ap->a_vp;
|
||||
lk = vp->v_vnlock;
|
||||
flags = ap->a_flags;
|
||||
|
||||
if ((flags & LK_INTERLOCK) != 0)
|
||||
VI_UNLOCK(vp);
|
||||
WITNESS_UNLOCK(&lk->lock_object, 0, LOCK_FILE, LOCK_LINE);
|
||||
LOCK_LOG_LOCK("SUNLOCK", &lk->lock_object, 0, 0, LOCK_FILE,
|
||||
LOCK_LINE);
|
||||
@ -811,7 +807,7 @@ lookup(struct nameidata *ndp)
|
||||
AUDIT_ARG_VNODE2(dp);
|
||||
|
||||
if (!(cnp->cn_flags & (LOCKPARENT | LOCKLEAF)))
|
||||
VOP_UNLOCK(dp, 0);
|
||||
VOP_UNLOCK(dp);
|
||||
/* XXX This should probably move to the top of function. */
|
||||
if (cnp->cn_flags & SAVESTART)
|
||||
panic("lookup: SAVESTART");
|
||||
@ -980,7 +976,7 @@ lookup(struct nameidata *ndp)
|
||||
goto bad;
|
||||
}
|
||||
if ((cnp->cn_flags & LOCKPARENT) == 0)
|
||||
VOP_UNLOCK(dp, 0);
|
||||
VOP_UNLOCK(dp);
|
||||
/*
|
||||
* We return with ni_vp NULL to indicate that the entry
|
||||
* doesn't currently exist, leaving a pointer to the
|
||||
@ -1049,7 +1045,7 @@ lookup(struct nameidata *ndp)
|
||||
* Symlink code always expects an unlocked dvp.
|
||||
*/
|
||||
if (ndp->ni_dvp != ndp->ni_vp) {
|
||||
VOP_UNLOCK(ndp->ni_dvp, 0);
|
||||
VOP_UNLOCK(ndp->ni_dvp);
|
||||
ni_dvp_unlocked = 1;
|
||||
}
|
||||
goto success;
|
||||
@ -1121,7 +1117,7 @@ lookup(struct nameidata *ndp)
|
||||
else
|
||||
vrele(ndp->ni_dvp);
|
||||
} else if ((cnp->cn_flags & LOCKPARENT) == 0 && ndp->ni_dvp != dp) {
|
||||
VOP_UNLOCK(ndp->ni_dvp, 0);
|
||||
VOP_UNLOCK(ndp->ni_dvp);
|
||||
ni_dvp_unlocked = 1;
|
||||
}
|
||||
|
||||
@ -1131,7 +1127,7 @@ lookup(struct nameidata *ndp)
|
||||
AUDIT_ARG_VNODE2(dp);
|
||||
|
||||
if ((cnp->cn_flags & LOCKLEAF) == 0)
|
||||
VOP_UNLOCK(dp, 0);
|
||||
VOP_UNLOCK(dp);
|
||||
success:
|
||||
/*
|
||||
* Because of shared lookup we may have the vnode shared locked, but
|
||||
@ -1211,7 +1207,7 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
|
||||
KASSERT(dp->v_type == VDIR, ("dp is not a directory"));
|
||||
|
||||
if (!(cnp->cn_flags & LOCKLEAF))
|
||||
VOP_UNLOCK(dp, 0);
|
||||
VOP_UNLOCK(dp);
|
||||
*vpp = dp;
|
||||
/* XXX This should probably move to the top of function. */
|
||||
if (cnp->cn_flags & SAVESTART)
|
||||
@ -1244,7 +1240,7 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
|
||||
if (cnp->cn_flags & SAVESTART)
|
||||
VREF(dvp);
|
||||
if ((cnp->cn_flags & LOCKPARENT) == 0)
|
||||
VOP_UNLOCK(dp, 0);
|
||||
VOP_UNLOCK(dp);
|
||||
/*
|
||||
* We return with ni_vp NULL to indicate that the entry
|
||||
* doesn't currently exist, leaving a pointer to the
|
||||
@ -1272,7 +1268,7 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
|
||||
*/
|
||||
if ((cnp->cn_flags & LOCKPARENT) == 0 && dvp != dp) {
|
||||
if (wantparent)
|
||||
VOP_UNLOCK(dvp, 0);
|
||||
VOP_UNLOCK(dvp);
|
||||
else
|
||||
vput(dvp);
|
||||
} else if (!wantparent)
|
||||
@ -1288,7 +1284,7 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp)
|
||||
VREF(dvp);
|
||||
|
||||
if ((cnp->cn_flags & LOCKLEAF) == 0)
|
||||
VOP_UNLOCK(dp, 0);
|
||||
VOP_UNLOCK(dp);
|
||||
return (0);
|
||||
bad:
|
||||
vput(dp);
|
||||
@ -1350,7 +1346,7 @@ NDFREE(struct nameidata *ndp, const u_int flags)
|
||||
ndp->ni_vp = NULL;
|
||||
}
|
||||
if (unlock_vp)
|
||||
VOP_UNLOCK(ndp->ni_vp, 0);
|
||||
VOP_UNLOCK(ndp->ni_vp);
|
||||
if (!(flags & NDF_NO_DVP_RELE) &&
|
||||
(ndp->ni_cnd.cn_flags & (LOCKPARENT|WANTPARENT))) {
|
||||
if (unlock_dvp) {
|
||||
@ -1361,7 +1357,7 @@ NDFREE(struct nameidata *ndp, const u_int flags)
|
||||
ndp->ni_dvp = NULL;
|
||||
}
|
||||
if (unlock_dvp)
|
||||
VOP_UNLOCK(ndp->ni_dvp, 0);
|
||||
VOP_UNLOCK(ndp->ni_dvp);
|
||||
if (!(flags & NDF_NO_STARTDIR_RELE) &&
|
||||
(ndp->ni_cnd.cn_flags & SAVESTART)) {
|
||||
vrele(ndp->ni_startdir);
|
||||
|
@ -951,7 +951,7 @@ vfs_domount_first(
|
||||
vput(vp);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/* Allocate and initialize the filesystem. */
|
||||
mp = vfs_mount_alloc(vp, vfsp, fspath, td->td_ucred);
|
||||
@ -983,7 +983,7 @@ vfs_domount_first(
|
||||
vrele(vp);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(newdp, 0);
|
||||
VOP_UNLOCK(newdp);
|
||||
|
||||
if (mp->mnt_opt != NULL)
|
||||
vfs_freeopts(mp->mnt_opt);
|
||||
@ -1015,9 +1015,9 @@ vfs_domount_first(
|
||||
mtx_unlock(&mountlist_mtx);
|
||||
vfs_event_signal(NULL, VQ_MOUNT, 0);
|
||||
vn_lock(newdp, LK_EXCLUSIVE | LK_RETRY);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
|
||||
VOP_UNLOCK(newdp, 0);
|
||||
VOP_UNLOCK(newdp);
|
||||
mountcheckdirs(vp, newdp);
|
||||
vrele(newdp);
|
||||
if ((mp->mnt_flag & MNT_RDONLY) == 0)
|
||||
@ -1090,7 +1090,7 @@ vfs_domount_update(
|
||||
}
|
||||
vp->v_iflag |= VI_MOUNT;
|
||||
VI_UNLOCK(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
vfs_op_enter(mp);
|
||||
|
||||
@ -1415,7 +1415,7 @@ dounmount_cleanup(struct mount *mp, struct vnode *coveredvp, int mntkflags)
|
||||
vfs_op_exit_locked(mp);
|
||||
MNT_IUNLOCK(mp);
|
||||
if (coveredvp != NULL) {
|
||||
VOP_UNLOCK(coveredvp, 0);
|
||||
VOP_UNLOCK(coveredvp);
|
||||
vdrop(coveredvp);
|
||||
}
|
||||
vn_finished_write(mp);
|
||||
@ -1607,7 +1607,7 @@ dounmount(struct mount *mp, int flags, struct thread *td)
|
||||
*/
|
||||
if (coveredvp->v_mountedhere != mp ||
|
||||
coveredvp->v_mountedhere->mnt_gen != mnt_gen_r) {
|
||||
VOP_UNLOCK(coveredvp, 0);
|
||||
VOP_UNLOCK(coveredvp);
|
||||
vdrop(coveredvp);
|
||||
vfs_rel(mp);
|
||||
return (EBUSY);
|
||||
@ -1621,7 +1621,7 @@ dounmount(struct mount *mp, int flags, struct thread *td)
|
||||
error = vfs_suser(mp, td);
|
||||
if (error != 0) {
|
||||
if (coveredvp != NULL) {
|
||||
VOP_UNLOCK(coveredvp, 0);
|
||||
VOP_UNLOCK(coveredvp);
|
||||
vdrop(coveredvp);
|
||||
}
|
||||
vfs_rel(mp);
|
||||
@ -1729,7 +1729,7 @@ dounmount(struct mount *mp, int flags, struct thread *td)
|
||||
vfs_op_exit_locked(mp);
|
||||
MNT_IUNLOCK(mp);
|
||||
if (coveredvp)
|
||||
VOP_UNLOCK(coveredvp, 0);
|
||||
VOP_UNLOCK(coveredvp);
|
||||
return (error);
|
||||
}
|
||||
mtx_lock(&mountlist_mtx);
|
||||
@ -1738,7 +1738,7 @@ dounmount(struct mount *mp, int flags, struct thread *td)
|
||||
EVENTHANDLER_DIRECT_INVOKE(vfs_unmounted, mp, td);
|
||||
if (coveredvp != NULL) {
|
||||
coveredvp->v_mountedhere = NULL;
|
||||
VOP_UNLOCK(coveredvp, 0);
|
||||
VOP_UNLOCK(coveredvp);
|
||||
}
|
||||
vfs_event_signal(NULL, VQ_UNMOUNT, 0);
|
||||
if (rootvnode != NULL && mp == rootvnode->v_mount) {
|
||||
|
@ -242,7 +242,7 @@ set_rootvnode(void)
|
||||
if (VFS_ROOT(TAILQ_FIRST(&mountlist), LK_EXCLUSIVE, &rootvnode))
|
||||
panic("set_rootvnode: Cannot find root vnode");
|
||||
|
||||
VOP_UNLOCK(rootvnode, 0);
|
||||
VOP_UNLOCK(rootvnode);
|
||||
|
||||
p = curthread->td_proc;
|
||||
FILEDESC_XLOCK(p->p_fd);
|
||||
@ -384,7 +384,7 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
|
||||
vp->v_mountedhere = mporoot;
|
||||
strlcpy(mporoot->mnt_stat.f_mntonname,
|
||||
fspath, MNAMELEN);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else
|
||||
vput(vp);
|
||||
}
|
||||
@ -412,7 +412,7 @@ vfs_mountroot_shuffle(struct thread *td, struct mount *mpdevfs)
|
||||
}
|
||||
mpdevfs->mnt_vnodecovered = vp;
|
||||
vp->v_mountedhere = mpdevfs;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else
|
||||
vput(vp);
|
||||
}
|
||||
@ -974,7 +974,7 @@ vfs_mountroot_readconf(struct thread *td, struct sbuf *sb)
|
||||
ofs += len - resid;
|
||||
}
|
||||
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
vn_close(nd.ni_vp, FREAD, td->td_ucred, td);
|
||||
return (error);
|
||||
}
|
||||
|
@ -413,7 +413,7 @@ sysctl_ftry_reclaim_vnode(SYSCTL_HANDLER_ARGS)
|
||||
|
||||
counter_u64_add(recycles_count, 1);
|
||||
vgone(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
drop:
|
||||
fdrop(fp, td);
|
||||
return (error);
|
||||
@ -1061,7 +1061,7 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src, int trigger)
|
||||
(!reclaim_nc_src && !LIST_EMPTY(&vp->v_cache_src)) ||
|
||||
(vp->v_object != NULL &&
|
||||
vp->v_object->resident_page_count > trigger)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdropl(vp);
|
||||
goto next_iter_mntunlocked;
|
||||
}
|
||||
@ -1069,7 +1069,7 @@ vlrureclaim(struct mount *mp, bool reclaim_nc_src, int trigger)
|
||||
("VIRF_DOOMED unexpectedly detected in vlrureclaim()"));
|
||||
counter_u64_add(recycles_count, 1);
|
||||
vgonel(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdropl(vp);
|
||||
done++;
|
||||
next_iter_mntunlocked:
|
||||
@ -1413,7 +1413,7 @@ vtryrecycle(struct vnode *vp)
|
||||
* Don't recycle if its filesystem is being suspended.
|
||||
*/
|
||||
if (vn_start_write(vp, &vnmp, V_NOWAIT) != 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
CTR2(KTR_VFS,
|
||||
"%s: impossible to recycle, cannot start the write for %p",
|
||||
__func__, vp);
|
||||
@ -1427,7 +1427,7 @@ vtryrecycle(struct vnode *vp)
|
||||
*/
|
||||
VI_LOCK(vp);
|
||||
if (vp->v_usecount) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
VI_UNLOCK(vp);
|
||||
vn_finished_write(vnmp);
|
||||
CTR2(KTR_VFS,
|
||||
@ -1439,7 +1439,7 @@ vtryrecycle(struct vnode *vp)
|
||||
counter_u64_add(recycles_count, 1);
|
||||
vgonel(vp);
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
VI_UNLOCK(vp);
|
||||
vn_finished_write(vnmp);
|
||||
return (0);
|
||||
@ -2408,7 +2408,7 @@ sync_vnode(struct synclist *slp, struct bufobj **bo, struct thread *td)
|
||||
}
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
(void) VOP_FSYNC(vp, MNT_LAZY, td);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
BO_LOCK(*bo);
|
||||
if (((*bo)->bo_flag & BO_ONWORKLST) != 0) {
|
||||
@ -3063,7 +3063,7 @@ vputx(struct vnode *vp, enum vputx_op func)
|
||||
if (vp->v_iflag & VI_OWEINACT)
|
||||
vinactive(vp, curthread);
|
||||
if (func != VPUTX_VUNREF)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
}
|
||||
vdropl(vp);
|
||||
}
|
||||
@ -3097,7 +3097,7 @@ void
|
||||
vput(struct vnode *vp)
|
||||
{
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vputx(vp, VPUTX_VPUT);
|
||||
}
|
||||
|
||||
@ -3376,7 +3376,7 @@ vflush(struct mount *mp, int rootrefs, int flags, struct thread *td)
|
||||
* Skip over a vnodes marked VV_SYSTEM.
|
||||
*/
|
||||
if ((flags & SKIPSYSTEM) && (vp->v_vflag & VV_SYSTEM)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdrop(vp);
|
||||
continue;
|
||||
}
|
||||
@ -3393,7 +3393,7 @@ vflush(struct mount *mp, int rootrefs, int flags, struct thread *td)
|
||||
}
|
||||
error = VOP_FSYNC(vp, MNT_WAIT, td);
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdrop(vp);
|
||||
MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
|
||||
return (error);
|
||||
@ -3404,7 +3404,7 @@ vflush(struct mount *mp, int rootrefs, int flags, struct thread *td)
|
||||
if ((vp->v_type == VNON ||
|
||||
(error == 0 && vattr.va_nlink > 0)) &&
|
||||
(vp->v_writecount <= 0 || vp->v_type != VREG)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdropl(vp);
|
||||
continue;
|
||||
}
|
||||
@ -3425,7 +3425,7 @@ vflush(struct mount *mp, int rootrefs, int flags, struct thread *td)
|
||||
vn_printf(vp, "vflush: busy vnode ");
|
||||
#endif
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vdropl(vp);
|
||||
}
|
||||
if (rootrefs > 0 && (flags & FORCECLOSE) == 0) {
|
||||
@ -3441,7 +3441,7 @@ vflush(struct mount *mp, int rootrefs, int flags, struct thread *td)
|
||||
if (busy == 1 && rootvp->v_usecount == rootrefs) {
|
||||
VOP_LOCK(rootvp, LK_EXCLUSIVE|LK_INTERLOCK);
|
||||
vgone(rootvp);
|
||||
VOP_UNLOCK(rootvp, 0);
|
||||
VOP_UNLOCK(rootvp);
|
||||
busy = 0;
|
||||
} else
|
||||
VI_UNLOCK(rootvp);
|
||||
@ -4506,7 +4506,7 @@ vfs_allocate_syncvnode(struct mount *mp)
|
||||
if (error != 0)
|
||||
panic("vfs_allocate_syncvnode: insmntque() failed");
|
||||
vp->v_vflag &= ~VV_FORCEINSMQ;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
/*
|
||||
* Place the vnode onto the syncer worklist. We attempt to
|
||||
* scatter them about on the list so that they will go off
|
||||
@ -5025,18 +5025,13 @@ vop_unlock_pre(void *ap)
|
||||
{
|
||||
struct vop_unlock_args *a = ap;
|
||||
|
||||
if (a->a_flags & LK_INTERLOCK)
|
||||
ASSERT_VI_LOCKED(a->a_vp, "VOP_UNLOCK");
|
||||
ASSERT_VOP_LOCKED(a->a_vp, "VOP_UNLOCK");
|
||||
}
|
||||
|
||||
void
|
||||
vop_unlock_post(void *ap, int rc)
|
||||
{
|
||||
struct vop_unlock_args *a = ap;
|
||||
|
||||
if (a->a_flags & LK_INTERLOCK)
|
||||
ASSERT_VI_UNLOCKED(a->a_vp, "VOP_UNLOCK");
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
@ -5367,7 +5362,7 @@ vfs_knlunlock(void *arg)
|
||||
{
|
||||
struct vnode *vp = arg;
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -366,7 +366,7 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf)
|
||||
mp = vp->v_mount;
|
||||
if (mp != NULL)
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
fdrop(fp, td);
|
||||
return (kern_do_statfs(td, mp, buf));
|
||||
}
|
||||
@ -854,7 +854,7 @@ sys_fchdir(struct thread *td, struct fchdir_args *uap)
|
||||
vput(vp);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
pwd_chdir(td, vp);
|
||||
return (0);
|
||||
}
|
||||
@ -889,7 +889,7 @@ kern_chdir(struct thread *td, const char *path, enum uio_seg pathseg)
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
return (error);
|
||||
}
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
pwd_chdir(td, nd.ni_vp);
|
||||
return (0);
|
||||
@ -925,7 +925,7 @@ sys_chroot(struct thread *td, struct chroot_args *uap)
|
||||
if (error != 0)
|
||||
goto e_vunlock;
|
||||
#endif
|
||||
VOP_UNLOCK(nd.ni_vp, 0);
|
||||
VOP_UNLOCK(nd.ni_vp);
|
||||
error = pwd_chroot(td, nd.ni_vp);
|
||||
vrele(nd.ni_vp);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
@ -1127,7 +1127,7 @@ kern_openat(struct thread *td, int fd, const char *path, enum uio_seg pathseg,
|
||||
DTYPE_VNODE, vp, &vnops);
|
||||
}
|
||||
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (flags & O_TRUNC) {
|
||||
error = fo_truncate(fp, 0, td->td_ucred, td);
|
||||
if (error != 0)
|
||||
@ -1568,7 +1568,7 @@ kern_linkat_vp(struct thread *td, struct vnode *vp, int fd, const char *path,
|
||||
return (EAGAIN);
|
||||
}
|
||||
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vput(nd.ni_dvp);
|
||||
vn_finished_write(mp);
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
@ -2622,7 +2622,7 @@ setfflags(struct thread *td, struct vnode *vp, u_long flags)
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
@ -2724,7 +2724,7 @@ sys_fchflags(struct thread *td, struct fchflags_args *uap)
|
||||
#ifdef AUDIT
|
||||
vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY);
|
||||
AUDIT_ARG_VNODE1(fp->f_vnode);
|
||||
VOP_UNLOCK(fp->f_vnode, 0);
|
||||
VOP_UNLOCK(fp->f_vnode);
|
||||
#endif
|
||||
error = setfflags(td, fp->f_vnode, uap->flags);
|
||||
fdrop(fp, td);
|
||||
@ -2751,7 +2751,7 @@ setfmode(struct thread *td, struct ucred *cred, struct vnode *vp, int mode)
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_SETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
@ -2878,7 +2878,7 @@ setfown(struct thread *td, struct ucred *cred, struct vnode *vp, uid_t uid,
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_SETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
@ -3097,7 +3097,7 @@ setutimes(struct thread *td, struct vnode *vp, const struct timespec *ts,
|
||||
#endif
|
||||
if (error == 0)
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
return (error);
|
||||
}
|
||||
@ -3225,7 +3225,7 @@ kern_futimes(struct thread *td, int fd, struct timeval *tptr,
|
||||
#ifdef AUDIT
|
||||
vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY);
|
||||
AUDIT_ARG_VNODE1(fp->f_vnode);
|
||||
VOP_UNLOCK(fp->f_vnode, 0);
|
||||
VOP_UNLOCK(fp->f_vnode);
|
||||
#endif
|
||||
error = setutimes(td, fp->f_vnode, ts, 2, tptr == NULL);
|
||||
fdrop(fp, td);
|
||||
@ -3259,7 +3259,7 @@ kern_futimens(struct thread *td, int fd, struct timespec *tptr,
|
||||
#ifdef AUDIT
|
||||
vn_lock(fp->f_vnode, LK_SHARED | LK_RETRY);
|
||||
AUDIT_ARG_VNODE1(fp->f_vnode);
|
||||
VOP_UNLOCK(fp->f_vnode, 0);
|
||||
VOP_UNLOCK(fp->f_vnode);
|
||||
#endif
|
||||
error = setutimes(td, fp->f_vnode, ts, 2, flags & UTIMENS_NULL);
|
||||
fdrop(fp, td);
|
||||
@ -3360,7 +3360,7 @@ kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg,
|
||||
vattr.va_size = length;
|
||||
error = VOP_SETATTR(vp, &vattr, td->td_ucred);
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
vn_rangelock_unlock(vp, rl_cookie);
|
||||
vrele(vp);
|
||||
@ -3436,7 +3436,7 @@ kern_fsync(struct thread *td, int fd, bool fullsync)
|
||||
VM_OBJECT_WUNLOCK(vp->v_object);
|
||||
}
|
||||
error = fullsync ? VOP_FSYNC(vp, MNT_WAIT, td) : VOP_FDATASYNC(vp, td);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
drop:
|
||||
fdrop(fp, td);
|
||||
@ -3525,9 +3525,9 @@ kern_renameat(struct thread *td, int oldfd, const char *old, int newfd,
|
||||
#ifdef MAC
|
||||
error = mac_vnode_check_rename_from(td->td_ucred, fromnd.ni_dvp,
|
||||
fromnd.ni_vp, &fromnd.ni_cnd);
|
||||
VOP_UNLOCK(fromnd.ni_dvp, 0);
|
||||
VOP_UNLOCK(fromnd.ni_dvp);
|
||||
if (fromnd.ni_dvp != fromnd.ni_vp)
|
||||
VOP_UNLOCK(fromnd.ni_vp, 0);
|
||||
VOP_UNLOCK(fromnd.ni_vp);
|
||||
#endif
|
||||
fvp = fromnd.ni_vp;
|
||||
NDINIT_ATRIGHTS(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE |
|
||||
@ -4067,7 +4067,7 @@ kern_getdirentries(struct thread *td, int fd, char *buf, size_t count,
|
||||
NULL);
|
||||
foffset = auio.uio_offset;
|
||||
if (error != 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
goto fail;
|
||||
}
|
||||
if (count == auio.uio_resid &&
|
||||
@ -4083,7 +4083,7 @@ kern_getdirentries(struct thread *td, int fd, char *buf, size_t count,
|
||||
vput(tvp);
|
||||
goto unionread;
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
*basep = loff;
|
||||
if (residp != NULL)
|
||||
*residp = auio.uio_resid;
|
||||
@ -4333,7 +4333,7 @@ kern_fhlinkat(struct thread *td, int fd, const char *path,
|
||||
vfs_unbusy(mp);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} while ((error = kern_linkat_vp(td, vp, fd, path, pathseg)) == EAGAIN);
|
||||
return (error);
|
||||
}
|
||||
@ -4446,7 +4446,7 @@ sys_fhopen(struct thread *td, struct fhopen_args *uap)
|
||||
fp->f_seqcount = 1;
|
||||
finit(fp, (fmode & FMASK) | (fp->f_flag & FHASLOCK), DTYPE_VNODE, vp,
|
||||
&vnops);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if ((fmode & O_TRUNC) != 0) {
|
||||
error = fo_truncate(fp, 0, td->td_ucred, td);
|
||||
if (error != 0)
|
||||
@ -4632,7 +4632,7 @@ kern_posix_fallocate(struct thread *td, int fd, off_t offset, off_t len)
|
||||
if (error == 0)
|
||||
#endif
|
||||
error = VOP_ALLOCATE(vp, &offset, &len);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
|
||||
if (olen + ooffset != offset + len) {
|
||||
|
@ -314,7 +314,7 @@ vn_open_vnode_advlock(struct vnode *vp, int fmode, struct file *fp)
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
lock_flags = VOP_ISLOCKED(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
lf.l_whence = SEEK_SET;
|
||||
lf.l_start = 0;
|
||||
@ -460,7 +460,7 @@ vn_close1(struct vnode *vp, int flags, struct ucred *file_cred,
|
||||
}
|
||||
error = VOP_CLOSE(vp, flags, file_cred, td);
|
||||
if (keep_ref)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
else
|
||||
vput(vp);
|
||||
vn_finished_write(mp);
|
||||
@ -613,7 +613,7 @@ vn_rdwr(enum uio_rw rw, struct vnode *vp, void *base, int len, off_t offset,
|
||||
if (auio.uio_resid && error == 0)
|
||||
error = EIO;
|
||||
if ((ioflg & IO_NODELOCKED) == 0) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (mp != NULL)
|
||||
vn_finished_write(mp);
|
||||
}
|
||||
@ -816,7 +816,7 @@ vn_read(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags,
|
||||
#endif
|
||||
error = VOP_READ(vp, uio, ioflag, fp->f_cred);
|
||||
fp->f_nextoff = uio->uio_offset;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error == 0 && advice == POSIX_FADV_NOREUSE &&
|
||||
orig_offset != uio->uio_offset)
|
||||
/*
|
||||
@ -891,7 +891,7 @@ vn_write(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags,
|
||||
#endif
|
||||
error = VOP_WRITE(vp, uio, ioflag, fp->f_cred);
|
||||
fp->f_nextoff = uio->uio_offset;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (vp->v_type != VCHR)
|
||||
vn_finished_write(mp);
|
||||
if (error == 0 && advice == POSIX_FADV_NOREUSE &&
|
||||
@ -1328,7 +1328,7 @@ vn_truncate(struct file *fp, off_t length, struct ucred *active_cred,
|
||||
error = vn_truncate_locked(vp, length, (fp->f_flag & O_FSYNC) != 0,
|
||||
fp->f_cred);
|
||||
out:
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
out1:
|
||||
vn_rangelock_unlock(vp, rl_cookie);
|
||||
@ -1369,7 +1369,7 @@ vn_statfile(struct file *fp, struct stat *sb, struct ucred *active_cred,
|
||||
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = vn_stat(vp, sb, active_cred, fp->f_cred, td);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
return (error);
|
||||
}
|
||||
@ -1505,7 +1505,7 @@ vn_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred,
|
||||
case FIONREAD:
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, active_cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error == 0)
|
||||
*(int *)data = vattr.va_size - fp->f_offset;
|
||||
return (error);
|
||||
@ -1519,7 +1519,7 @@ vn_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred,
|
||||
#endif
|
||||
error = VOP_BMAP(vp, bmarg->bn, NULL,
|
||||
&bmarg->bn, &bmarg->runp, &bmarg->runb);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
return (error);
|
||||
case FIONBIO:
|
||||
case FIOASYNC:
|
||||
@ -1552,7 +1552,7 @@ vn_poll(struct file *fp, int events, struct ucred *active_cred,
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
AUDIT_ARG_VNODE1(vp);
|
||||
error = mac_vnode_check_poll(active_cred, fp->f_cred, vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (!error)
|
||||
#endif
|
||||
|
||||
@ -1580,7 +1580,7 @@ _vn_lock(struct vnode *vp, int flags, char *file, int line)
|
||||
|
||||
if ((flags & LK_RETRY) == 0) {
|
||||
if (error == 0 && VN_IS_DOOMED(vp)) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = ENOENT;
|
||||
}
|
||||
} else if (error != 0)
|
||||
@ -2015,7 +2015,7 @@ vn_extattr_get(struct vnode *vp, int ioflg, int attrnamespace,
|
||||
td);
|
||||
|
||||
if ((ioflg & IO_NODELOCKED) == 0)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
if (error == 0) {
|
||||
*buflen = *buflen - auio.uio_resid;
|
||||
@ -2060,7 +2060,7 @@ vn_extattr_set(struct vnode *vp, int ioflg, int attrnamespace,
|
||||
|
||||
if ((ioflg & IO_NODELOCKED) == 0) {
|
||||
vn_finished_write(mp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
}
|
||||
|
||||
return (error);
|
||||
@ -2089,7 +2089,7 @@ vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace,
|
||||
|
||||
if ((ioflg & IO_NODELOCKED) == 0) {
|
||||
vn_finished_write(mp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
}
|
||||
|
||||
return (error);
|
||||
@ -2126,7 +2126,7 @@ vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, void *alloc_arg,
|
||||
error = vfs_busy(mp, MBF_NOWAIT);
|
||||
if (error != 0) {
|
||||
vfs_ref(mp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = vfs_busy(mp, 0);
|
||||
vn_lock(vp, ltype | LK_RETRY);
|
||||
vfs_rel(mp);
|
||||
@ -2137,7 +2137,7 @@ vn_vget_ino_gen(struct vnode *vp, vn_get_ino_t alloc, void *alloc_arg,
|
||||
return (ENOENT);
|
||||
}
|
||||
}
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = alloc(mp, alloc_arg, lkflags, rvp);
|
||||
vfs_unbusy(mp);
|
||||
if (error != 0 || *rvp != vp)
|
||||
@ -2181,7 +2181,7 @@ vn_chmod(struct file *fp, mode_t mode, struct ucred *active_cred,
|
||||
#ifdef AUDIT
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
AUDIT_ARG_VNODE1(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
#endif
|
||||
return (setfmode(td, active_cred, vp, mode));
|
||||
}
|
||||
@ -2196,7 +2196,7 @@ vn_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred,
|
||||
#ifdef AUDIT
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
AUDIT_ARG_VNODE1(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
#endif
|
||||
return (setfown(td, active_cred, vp, uid, gid));
|
||||
}
|
||||
@ -2261,7 +2261,7 @@ vn_bmap_seekhole(struct vnode *vp, u_long cmd, off_t *off, struct ucred *cred)
|
||||
if (cmd == FIOSEEKDATA)
|
||||
error = ENXIO;
|
||||
unlock:
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error == 0)
|
||||
*off = noff;
|
||||
return (error);
|
||||
@ -2294,7 +2294,7 @@ vn_seek(struct file *fp, off_t offset, int whence, struct thread *td)
|
||||
case L_XTND:
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &vattr, cred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error)
|
||||
break;
|
||||
|
||||
@ -2428,7 +2428,7 @@ vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif)
|
||||
va.va_rdev = NODEV;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
error = VOP_GETATTR(vp, &va, curthread->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
if (va.va_fsid != VNOVAL)
|
||||
@ -2879,7 +2879,7 @@ vn_write_outvp(struct vnode *outvp, char *dat, off_t outoff, off_t xfer,
|
||||
outoff += xfer2;
|
||||
xfer -= xfer2;
|
||||
}
|
||||
VOP_UNLOCK(outvp, 0);
|
||||
VOP_UNLOCK(outvp);
|
||||
}
|
||||
if (mp != NULL)
|
||||
vn_finished_write(mp);
|
||||
@ -2920,7 +2920,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp,
|
||||
goto out;
|
||||
if (VOP_PATHCONF(invp, _PC_MIN_HOLE_SIZE, &holein) != 0)
|
||||
holein = 0;
|
||||
VOP_UNLOCK(invp, 0);
|
||||
VOP_UNLOCK(invp);
|
||||
|
||||
mp = NULL;
|
||||
error = vn_start_write(outvp, &mp, V_WAIT);
|
||||
@ -2960,7 +2960,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp,
|
||||
if (error == 0)
|
||||
va.va_size = *outoffp;
|
||||
}
|
||||
VOP_UNLOCK(outvp, 0);
|
||||
VOP_UNLOCK(outvp);
|
||||
}
|
||||
if (mp != NULL)
|
||||
vn_finished_write(mp);
|
||||
@ -3084,7 +3084,7 @@ vn_generic_copy_file_range(struct vnode *invp, off_t *inoffp,
|
||||
startoff, UIO_SYSSPACE, IO_NODELOCKED,
|
||||
curthread->td_ucred, incred, &aresid,
|
||||
curthread);
|
||||
VOP_UNLOCK(invp, 0);
|
||||
VOP_UNLOCK(invp);
|
||||
lastblock = false;
|
||||
if (error == 0 && aresid > 0) {
|
||||
/* Stop the copy at EOF on the input file. */
|
||||
|
@ -390,7 +390,6 @@ vop_lock1 {
|
||||
|
||||
vop_unlock {
|
||||
IN struct vnode *vp;
|
||||
IN int flags;
|
||||
};
|
||||
|
||||
|
||||
|
@ -257,7 +257,7 @@ nfs_dolock(struct vop_advlock_args *ap)
|
||||
|
||||
nmp->nm_getinfo(vp, msg.lm_fh, &msg.lm_fh_len, &msg.lm_addr,
|
||||
&msg.lm_nfsv3, NULL, NULL);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
/*
|
||||
* the NLM protocol doesn't allow the server to return an error
|
||||
|
@ -253,7 +253,7 @@ nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl,
|
||||
td->td_ucred = vp->v_mount->mnt_cred;
|
||||
crhold(td->td_ucred);
|
||||
if (unlock_vp)
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
|
||||
host = nlm_find_host_by_name(servername, sa, vers);
|
||||
auth = authunix_create(cred);
|
||||
|
@ -1797,7 +1797,7 @@ nlm_get_vfs_state(struct nlm_host *host, struct svc_req *rqstp,
|
||||
#if __FreeBSD_version < 800011
|
||||
VOP_UNLOCK(vs->vs_vp, 0, curthread);
|
||||
#else
|
||||
VOP_UNLOCK(vs->vs_vp, 0);
|
||||
VOP_UNLOCK(vs->vs_vp);
|
||||
#endif
|
||||
vs->vs_vnlocked = FALSE;
|
||||
|
||||
|
@ -690,7 +690,7 @@ audit_arg_file(struct proc *p, struct file *fp)
|
||||
vp = fp->f_vnode;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
audit_arg_vnode1(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
break;
|
||||
|
||||
case DTYPE_SOCKET:
|
||||
@ -978,6 +978,6 @@ audit_sysclose(struct thread *td, int fd)
|
||||
vp = fp->f_vnode;
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
audit_arg_vnode1(vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
fdrop(fp, td);
|
||||
}
|
||||
|
@ -811,13 +811,13 @@ sys_auditctl(struct thread *td, struct auditctl_args *uap)
|
||||
vp = nd.ni_vp;
|
||||
#ifdef MAC
|
||||
error = mac_system_check_auditctl(td->td_ucred, vp);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
if (error) {
|
||||
vn_close(vp, AUDIT_CLOSE_FLAGS, td->td_ucred, td);
|
||||
return (error);
|
||||
}
|
||||
#else
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
#endif
|
||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||
if (vp->v_type != VREG) {
|
||||
|
@ -119,7 +119,7 @@ audit_worker_sync_vp(struct vnode *vp, struct mount *mp, const char *fmt, ...)
|
||||
if (error == 0) {
|
||||
VOP_LOCK(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
(void)VOP_FSYNC(vp, MNT_WAIT, curthread);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp1);
|
||||
}
|
||||
vfs_unbusy(mp);
|
||||
@ -503,7 +503,7 @@ audit_rotate_vnode(struct ucred *cred, struct vnode *vp)
|
||||
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||
if (VOP_GETATTR(vp, &vattr, cred) != 0)
|
||||
vattr.va_size = 0;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
} else {
|
||||
vattr.va_size = 0;
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ mac_proc_vm_revoke_recurse(struct thread *td, struct ucred *cred,
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
result = vme->max_protection;
|
||||
mac_vnode_check_mmap_downgrade(cred, vp, &result);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
/*
|
||||
* Find out what maximum protection we may be allowing now
|
||||
* but a policy needs to get removed.
|
||||
@ -339,7 +339,7 @@ mac_proc_vm_revoke_recurse(struct thread *td, struct ucred *cred,
|
||||
vm_object_page_clean(object, offset, offset +
|
||||
vme->end - vme->start, OBJPC_SYNC);
|
||||
VM_OBJECT_WUNLOCK(object);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
vm_object_deallocate(object);
|
||||
/*
|
||||
|
@ -268,7 +268,7 @@ sys___mac_get_fd(struct thread *td, struct __mac_get_fd_args *uap)
|
||||
intlabel = mac_vnode_label_alloc();
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
mac_vnode_copy_label(vp->v_label, intlabel);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
error = mac_vnode_externalize_label(intlabel, elements,
|
||||
buffer, mac.m_buflen);
|
||||
mac_vnode_label_free(intlabel);
|
||||
@ -436,7 +436,7 @@ sys___mac_set_fd(struct thread *td, struct __mac_set_fd_args *uap)
|
||||
}
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
error = vn_setlabel(vp, intlabel, td->td_ucred);
|
||||
VOP_UNLOCK(vp, 0);
|
||||
VOP_UNLOCK(vp);
|
||||
vn_finished_write(mp);
|
||||
mac_vnode_label_free(intlabel);
|
||||
break;
|
||||
|
@ -691,7 +691,7 @@ mac_veriexec_syscall(struct thread *td, int call, void *arg)
|
||||
((va.va_mode & (S_IXUSR|S_IXGRP|S_IXOTH)) == 0), td);
|
||||
check_done:
|
||||
/* Release the lock we obtained earlier */
|
||||
VOP_UNLOCK(img.vp, 0);
|
||||
VOP_UNLOCK(img.vp);
|
||||
cleanup_file:
|
||||
fdrop(fp, td);
|
||||
break;
|
||||
|
@ -291,7 +291,7 @@ read_manifest(char *path, unsigned char *digest)
|
||||
|
||||
data[bytes_read] = '\0';
|
||||
|
||||
VOP_UNLOCK(nid.ni_vp, 0);
|
||||
VOP_UNLOCK(nid.ni_vp);
|
||||
(void)vn_close(nid.ni_vp, FREAD, curthread->td_ucred, curthread);
|
||||
|
||||
/*
|
||||
@ -370,7 +370,7 @@ parse_entry(char *entry, char *prefix)
|
||||
mtx_unlock(&ve_mutex);
|
||||
|
||||
out:
|
||||
VOP_UNLOCK(nid.ni_vp, 0);
|
||||
VOP_UNLOCK(nid.ni_vp);
|
||||
vn_close(nid.ni_vp, FREAD, curthread->td_ucred, curthread);
|
||||
return (rc);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
* in the range 5 to 9.
|
||||
*/
|
||||
#undef __FreeBSD_version
|
||||
#define __FreeBSD_version 1300073 /* Master, propagated to newvers */
|
||||
#define __FreeBSD_version 1300074 /* Master, propagated to newvers */
|
||||
|
||||
/*
|
||||
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
|
||||
|
@ -964,7 +964,7 @@ void vn_fsid(struct vnode *vp, struct vattr *va);
|
||||
(flags & ~(LK_INTERLOCK | LK_RELEASE)) == 0 : 1); \
|
||||
if ((_flags & ~(LK_INTERLOCK | LK_RELEASE)) != 0) \
|
||||
panic("%s: unsupported flags %x\n", __func__, flags); \
|
||||
_error = VOP_UNLOCK(_vp, 0); \
|
||||
_error = VOP_UNLOCK(_vp); \
|
||||
if (_flags & LK_INTERLOCK) \
|
||||
VI_UNLOCK(_vp); \
|
||||
_error; \
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user