From 4f12c8ab063383cd7d25f15b13b7a1240c0c5dc3 Mon Sep 17 00:00:00 2001 From: semarie Date: Tue, 19 Oct 2021 06:11:45 +0000 Subject: [PATCH] vnode: do not manipulate vnode lock directly use VOP_LOCK / VOP_UNLOCK wrappers. VOP_LOCK() is prefered over vn_lock() here in order to keep equivalent code. ok mpi@ visa@ (as part of larger diff) --- sys/isofs/cd9660/cd9660_node.c | 4 ++-- sys/nfs/nfs_node.c | 4 ++-- sys/ufs/ufs/ufs_ihash.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c index 38ca5b3e196..bce99d77c22 100644 --- a/sys/isofs/cd9660/cd9660_node.c +++ b/sys/isofs/cd9660/cd9660_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_node.c,v 1.37 2021/03/05 07:10:06 jsg Exp $ */ +/* $OpenBSD: cd9660_node.c,v 1.38 2021/10/19 06:11:45 semarie Exp $ */ /* $NetBSD: cd9660_node.c,v 1.17 1997/05/05 07:13:57 mycroft Exp $ */ /*- @@ -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); } diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c index 81b900e83d2..5c98411501b 100644 --- a/sys/nfs/nfs_node.c +++ b/sys/nfs/nfs_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_node.c,v 1.71 2020/01/20 23:21:56 claudio Exp $ */ +/* $OpenBSD: nfs_node.c,v 1.72 2021/10/19 06:11:45 semarie Exp $ */ /* $NetBSD: nfs_node.c,v 1.16 1996/02/18 11:53:42 fvdl Exp $ */ /* @@ -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; diff --git a/sys/ufs/ufs/ufs_ihash.c b/sys/ufs/ufs/ufs_ihash.c index 2fef0bc139d..c83da438fe1 100644 --- a/sys/ufs/ufs/ufs_ihash.c +++ b/sys/ufs/ufs/ufs_ihash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_ihash.c,v 1.25 2021/03/11 13:31:36 jsg Exp $ */ +/* $OpenBSD: ufs_ihash.c,v 1.26 2021/10/19 06:11:45 semarie Exp $ */ /* $NetBSD: ufs_ihash.c,v 1.3 1996/02/09 22:36:04 christos Exp $ */ /* @@ -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); } } -- 2.20.1