lock the inode before putting it on the hash list
authorJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Thu, 18 May 1995 02:36:18 +0000 (18:36 -0800)
committerJan-Simon Pendry <pendry@ucbvax.Berkeley.EDU>
Thu, 18 May 1995 02:36:18 +0000 (18:36 -0800)
SCCS-vsn: sys/ufs/ufs/ufs_ihash.c 8.7

usr/src/sys/ufs/ufs/ufs_ihash.c

index a74b260..ec51a5f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_ihash.c 8.6 (Berkeley) %G%
+ *     @(#)ufs_ihash.c 8.7 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -97,12 +97,13 @@ ufs_ihashins(ip)
        struct proc *p = curproc;               /* XXX */
        struct ihashhead *ipp;
 
        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);
        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);
 }
 
 /*
 }
 
 /*