Hi,
The following diff is still without intented behaviour changes.
The first chunk replaces a direct vp->v_op->vop_lock() call by
VOP_LOCK() wrapper. It only adds some safety check on vop_lock being
NULL (and MUTEX_ASSERT_UNLOCKED on vnode_mtx).
Others chunks replaces several direct manipulation of vnode lock by
VOP_LOCK / VOP_UNLOCK calls (instead of rrw_enter / rrw_exit). I
prefered VOP_LOCK() over vn_lock() to keep the code bug-to-bug
equivalent (if any).
Comments or OK ?
--
Sebastien Marie
diff e44725a8dd99f82f94f37ecff5c0e710c4dba97e
/home/semarie/repos/openbsd/sys-clean
blob - a2a4643c4649ece502b8af46328cd953a7a93450
file + miscfs/deadfs/dead_vnops.c
--- miscfs/deadfs/dead_vnops.c
+++ miscfs/deadfs/dead_vnops.c
@@ -227,7 +227,7 @@ dead_lock(void *v)
if (ap->a_flags & LK_DRAIN || !chkvnlock(vp))
return (0);
- return ((vp->v_op->vop_lock)(ap));
+ return VOP_LOCK(vp, ap->a_flags);
}
/*
blob - 38ca5b3e196592ea7d5a66d1d1bef52f99d9ecb2
file + isofs/cd9660/cd9660_node.c
--- isofs/cd9660/cd9660_node.c
+++ isofs/cd9660/cd9660_node.c
@@ -140,7 +140,7 @@ cd9660_ihashins(struct iso_node *ip)
*ipp = ip;
/* XXX locking unlock hash list? */
- rrw_enter(&ip->i_lock, RW_WRITE);
+ VOP_LOCK(ITOV(ip), LK_EXCLUSIVE);
return (0);
}
blob - 81b900e83d2071d8450f35cfae42c6cb91f1a414
file + nfs/nfs_node.c
--- nfs/nfs_node.c
+++ nfs/nfs_node.c
@@ -146,7 +146,7 @@ loop:
bcopy(fh, np->n_fhp, fhsize);
np->n_fhsize = fhsize;
/* lock the nfsnode, then put it on the rbtree */
- rrw_enter(&np->n_lock, RW_WRITE);
+ VOP_LOCK(vp, LK_EXCLUSIVE);
np2 = RBT_INSERT(nfs_nodetree, &nmp->nm_ntree, np);
KASSERT(np2 == NULL);
np->n_accstamp = -1;
blob - 2fef0bc139da82177ec809f76c30da4afef249f3
file + ufs/ufs/ufs_ihash.c
--- ufs/ufs/ufs_ihash.c
+++ ufs/ufs/ufs_ihash.c
@@ -137,7 +137,7 @@ ufs_ihashins(struct inode *ip)
ufsino_t inum = ip->i_number;
/* lock the inode, then put it on the appropriate hash list */
- rrw_enter(&ip->i_lock, RW_WRITE);
+ VOP_LOCK(ITOV(ip), LK_EXCLUSIVE);
/* XXXLOCKING lock hash list */
@@ -145,7 +145,7 @@ ufs_ihashins(struct inode *ip)
LIST_FOREACH(curip, ipp, i_hash) {
if (inum == curip->i_number && dev == curip->i_dev) {
/* XXXLOCKING unlock hash list? */
- rrw_exit(&ip->i_lock);
+ VOP_UNLOCK(ITOV(ip));
return (EEXIST);
}
}