Conver all explicit instances to VOP_ISLOCKED(arg, NULL) into
VOP_ISLOCKED(arg, curthread). Now, VOP_ISLOCKED() and lockstatus() should only acquire curthread as argument; this will lead in axing the additional argument from both functions, making the code cleaner. Reviewed by: jeff, kib
This commit is contained in:
parent
5e9f6b73ee
commit
2433c4883e
@ -107,7 +107,7 @@ nullfs_mount(struct mount *mp, struct thread *td)
|
||||
* (XXX) VOP_ISLOCKED is needed?
|
||||
*/
|
||||
if ((mp->mnt_vnodecovered->v_op == &null_vnodeops) &&
|
||||
VOP_ISLOCKED(mp->mnt_vnodecovered, NULL)) {
|
||||
VOP_ISLOCKED(mp->mnt_vnodecovered, curthread)) {
|
||||
VOP_UNLOCK(mp->mnt_vnodecovered, 0);
|
||||
isvnunlocked = 1;
|
||||
}
|
||||
@ -120,7 +120,7 @@ nullfs_mount(struct mount *mp, struct thread *td)
|
||||
/*
|
||||
* Re-lock vnode.
|
||||
*/
|
||||
if (isvnunlocked && !VOP_ISLOCKED(mp->mnt_vnodecovered, NULL))
|
||||
if (isvnunlocked && !VOP_ISLOCKED(mp->mnt_vnodecovered, curthread))
|
||||
vn_lock(mp->mnt_vnodecovered, LK_EXCLUSIVE | LK_RETRY);
|
||||
|
||||
if (error)
|
||||
@ -247,7 +247,7 @@ nullfs_root(mp, flags, vpp, td)
|
||||
VREF(vp);
|
||||
|
||||
#ifdef NULLFS_DEBUG
|
||||
if (VOP_ISLOCKED(vp, NULL))
|
||||
if (VOP_ISLOCKED(vp, curthread))
|
||||
panic("root vnode is locked.\n");
|
||||
#endif
|
||||
vn_lock(vp, flags | LK_RETRY);
|
||||
|
@ -606,7 +606,7 @@ lockstatus(lkp, td)
|
||||
int lock_type = 0;
|
||||
int interlocked;
|
||||
|
||||
KASSERT(td == NULL || td == curthread,
|
||||
KASSERT(td == curthread,
|
||||
("%s: thread passed argument (%p) is not valid", __func__, td));
|
||||
|
||||
if (!kdb_active) {
|
||||
@ -615,7 +615,7 @@ lockstatus(lkp, td)
|
||||
} else
|
||||
interlocked = 0;
|
||||
if (lkp->lk_exclusivecount != 0) {
|
||||
if (td == NULL || lkp->lk_lockholder == td)
|
||||
if (lkp->lk_lockholder == td)
|
||||
lock_type = LK_EXCLUSIVE;
|
||||
else
|
||||
lock_type = LK_EXCLOTHER;
|
||||
|
@ -1638,7 +1638,7 @@ restart:
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
vfslocked = 0;
|
||||
}
|
||||
if (VOP_ISLOCKED(vp, NULL) != 0) {
|
||||
if (VOP_ISLOCKED(vp, curthread) != 0) {
|
||||
VFS_UNLOCK_GIANT(vfslocked);
|
||||
return (1);
|
||||
}
|
||||
@ -2208,7 +2208,7 @@ vput(struct vnode *vp)
|
||||
*/
|
||||
v_decr_useonly(vp);
|
||||
vp->v_iflag |= VI_OWEINACT;
|
||||
if (VOP_ISLOCKED(vp, NULL) != LK_EXCLUSIVE) {
|
||||
if (VOP_ISLOCKED(vp, curthread) != LK_EXCLUSIVE) {
|
||||
error = VOP_LOCK(vp, LK_UPGRADE|LK_INTERLOCK|LK_NOWAIT);
|
||||
VI_LOCK(vp);
|
||||
if (error) {
|
||||
@ -2684,7 +2684,8 @@ DB_SHOW_COMMAND(lockedvnods, lockedvnodes)
|
||||
for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
|
||||
nmp = TAILQ_NEXT(mp, mnt_list);
|
||||
TAILQ_FOREACH(vp, &mp->mnt_nvnodelist, v_nmntvnodes) {
|
||||
if (vp->v_type != VMARKER && VOP_ISLOCKED(vp, NULL))
|
||||
if (vp->v_type != VMARKER &&
|
||||
VOP_ISLOCKED(vp, curthread))
|
||||
vprint("", vp);
|
||||
}
|
||||
nmp = TAILQ_NEXT(mp, mnt_list);
|
||||
@ -2971,7 +2972,7 @@ vfs_msync(struct mount *mp, int flags)
|
||||
MNT_VNODE_FOREACH(vp, mp, mvp) {
|
||||
VI_LOCK(vp);
|
||||
if ((vp->v_iflag & VI_OBJDIRTY) &&
|
||||
(flags == MNT_WAIT || VOP_ISLOCKED(vp, NULL) == 0)) {
|
||||
(flags == MNT_WAIT || VOP_ISLOCKED(vp, curthread) == 0)) {
|
||||
MNT_IUNLOCK(mp);
|
||||
if (!vget(vp,
|
||||
LK_EXCLUSIVE | LK_RETRY | LK_INTERLOCK,
|
||||
@ -3478,7 +3479,7 @@ void
|
||||
assert_vop_locked(struct vnode *vp, const char *str)
|
||||
{
|
||||
|
||||
if (vp && !IGNORE_LOCK(vp) && VOP_ISLOCKED(vp, NULL) == 0)
|
||||
if (vp && !IGNORE_LOCK(vp) && VOP_ISLOCKED(vp, curthread) == 0)
|
||||
vfs_badlock("is not locked but should be", str, vp);
|
||||
}
|
||||
|
||||
|
@ -749,7 +749,7 @@ loop:
|
||||
MNT_VNODE_FOREACH(vp, mp, mvp) {
|
||||
VI_LOCK(vp);
|
||||
MNT_IUNLOCK(mp);
|
||||
if (VOP_ISLOCKED(vp, NULL) ||
|
||||
if (VOP_ISLOCKED(vp, curthread) ||
|
||||
vp->v_bufobj.bo_dirty.bv_cnt == 0 ||
|
||||
waitfor == MNT_LAZY) {
|
||||
VI_UNLOCK(vp);
|
||||
|
@ -1050,7 +1050,7 @@ loop:
|
||||
MNT_VNODE_FOREACH(vp, mp, mvp) {
|
||||
VI_LOCK(vp);
|
||||
MNT_IUNLOCK(mp);
|
||||
if (VOP_ISLOCKED(vp, NULL) ||
|
||||
if (VOP_ISLOCKED(vp, curthread) ||
|
||||
vp->v_bufobj.bo_dirty.bv_cnt == 0 ||
|
||||
waitfor == MNT_LAZY) {
|
||||
VI_UNLOCK(vp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user