summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>1998-01-09 20:39:55 +0000
committerConstantine Sapuntzakis <csapuntz@cvs.openbsd.org>1998-01-09 20:39:55 +0000
commit603148636aa98e7bbc644c7cf99ada8f2fb1a5d3 (patch)
treed60c3c62df3a696bf28d9dad9d475ec14d3c3372 /sys
parent38226a2929159aed5ae343513ff593dc5130de71 (diff)
Correction of long-standing race condition in vnode creation due to
possible sleep in MALLOC
Diffstat (limited to 'sys')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 425b3babfe5..65df3ceb414 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.14 1997/12/09 04:54:42 deraadt Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.15 1998/01/09 20:39:54 csapuntz Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -835,6 +835,8 @@ ffs_vget(mp, ino, vpp)
ump = VFSTOUFS(mp);
dev = ump->um_dev;
+
+retry:
if ((*vpp = ufs_ihashget(dev, ino)) != NULL)
return (0);
@@ -866,8 +868,20 @@ ffs_vget(mp, ino, vpp)
* for old data structures to be purged or for the contents of the
* disk portion of this inode to be read.
*/
- ufs_ihashins(ip);
+ error = ufs_ihashins(ip);
+
+ if (error) {
+ /* VOP_INACTIVE will treat this as a stale file
+ and recycle it quickly */
+ vrele(vp);
+
+ if (error == EEXIST)
+ goto retry;
+ return (error);
+ }
+
+
/* Read in the disk contents for the inode, copy into the inode. */
error = bread(ump->um_devvp, fsbtodb(fs, ino_to_fsba(fs, ino)),
(int)fs->fs_bsize, NOCRED, &bp);