summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1995-07-21 16:20:20 +0000
committerdg <dg@FreeBSD.org>1995-07-21 16:20:20 +0000
commit5d7eb9210cba744bb5f0d6952e8234ee6e958c2b (patch)
treeb3a2076fe2c5bbcce06d1b8a3c05f50000b7f6e3 /sys/ufs
parent0549ed42b33ebf6984d61457e2b156f1a3d8cc2d (diff)
downloadFreeBSD-src-5d7eb9210cba744bb5f0d6952e8234ee6e958c2b.zip
FreeBSD-src-5d7eb9210cba744bb5f0d6952e8234ee6e958c2b.tar.gz
Since ufs_ihashget can block, the lock must be checked for each time
the function returns. Also, moved lock into .bss and made minor cosmetic changes. Submitted by: Bruce Evans
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index a3595d4..2b2bb86 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94
- * $Id: ffs_vfsops.c,v 1.23 1995/07/13 08:48:05 davidg Exp $
+ * $Id: ffs_vfsops.c,v 1.24 1995/07/21 03:52:40 davidg Exp $
*/
#include <sys/param.h>
@@ -737,8 +737,7 @@ loop:
* return the inode locked. Detection and handling of mount points must be
* done by the calling routine.
*/
-
-int ffs_inode_hash_lock = 0;
+int ffs_inode_hash_lock;
int
ffs_vget(mp, ino, vpp)
@@ -756,12 +755,13 @@ ffs_vget(mp, ino, vpp)
ump = VFSTOUFS(mp);
dev = ump->um_dev;
+restart:
if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
return (0);
/*
- * Lockout the creation of new entries in the FFS hash table
- * in case getnewvnode/MALLOC blocks, otherwise a duplicate
+ * Lock out the creation of new entries in the FFS hash table in
+ * case getnewvnode() or MALLOC() blocks, otherwise a duplicate
* may occur!
*/
if (ffs_inode_hash_lock) {
@@ -769,17 +769,15 @@ ffs_vget(mp, ino, vpp)
ffs_inode_hash_lock = -1;
tsleep(&ffs_inode_hash_lock, PVM, "ffsvgt", 0);
}
- if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
- return (0);
+ goto restart;
}
ffs_inode_hash_lock = 1;
/* Allocate a new vnode/inode. */
error = getnewvnode(VT_UFS, mp, ffs_vnodeop_p, &vp);
if (error) {
- if (ffs_inode_hash_lock < 0) {
+ if (ffs_inode_hash_lock < 0)
wakeup(&ffs_inode_hash_lock);
- }
ffs_inode_hash_lock = 0;
*vpp = NULL;
return (error);
@@ -807,12 +805,8 @@ ffs_vget(mp, ino, vpp)
*/
ufs_ihashins(ip);
- /*
- * Wakeup anybody blocked on our lock
- */
- if (ffs_inode_hash_lock < 0) {
+ if (ffs_inode_hash_lock < 0)
wakeup(&ffs_inode_hash_lock);
- }
ffs_inode_hash_lock = 0;
/* Read in the disk contents for the inode, copy into the inode. */
OpenPOWER on IntegriCloud