From: Jan-Simon Pendry Date: Thu, 18 May 1995 02:36:18 +0000 (-0800) Subject: lock the inode before putting it on the hash list X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/d1162b46ac77b917ee377bb247c53e51804bca96 lock the inode before putting it on the hash list SCCS-vsn: sys/ufs/ufs/ufs_ihash.c 8.7 --- diff --git a/usr/src/sys/ufs/ufs/ufs_ihash.c b/usr/src/sys/ufs/ufs/ufs_ihash.c index a74b2609f7..ec51a5f970 100644 --- a/usr/src/sys/ufs/ufs/ufs_ihash.c +++ b/usr/src/sys/ufs/ufs/ufs_ihash.c @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)ufs_ihash.c 8.6 (Berkeley) %G% + * @(#)ufs_ihash.c 8.7 (Berkeley) %G% */ #include @@ -97,12 +97,13 @@ ufs_ihashins(ip) struct proc *p = curproc; /* XXX */ struct ihashhead *ipp; + /* lock the inode, then put it on the appropriate hash list */ + lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); + simple_lock(&ufs_ihash_slock); ipp = INOHASH(ip->i_dev, ip->i_number); LIST_INSERT_HEAD(ipp, ip, i_hash); simple_unlock(&ufs_ihash_slock); - - lockmgr(&ip->i_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); } /*