summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2005-04-04 11:43:44 +0000
committerjeff <jeff@FreeBSD.org>2005-04-04 11:43:44 +0000
commitb6f8b968c23aec5369c008801a56e489183a2792 (patch)
tree80406a844d763701ccc2cdf130614602bc459c37
parent005afc0afa7cd34e2b636c30caa9d3862394c5c4 (diff)
downloadFreeBSD-src-b6f8b968c23aec5369c008801a56e489183a2792.zip
FreeBSD-src-b6f8b968c23aec5369c008801a56e489183a2792.tar.gz
- Instead of waiting forever to get a vnode in getnewvnode() wait for
one to become available for one second and then return ENFILE. We can run out of vnodes, and there must be a hard limit because without one we can quickly run out of KVA on x86. Presently the system can deadlock if there are maxvnodes directories in the namecache. The original 4.x BSD behavior was to return ENFILE if we reached the max, but 4.x BSD did not have the vnlru proc so it was less profitable to wait.
-rw-r--r--sys/kern/vfs_subr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 7cb1ac4..dfa5a68 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -815,13 +815,15 @@ getnewvnode(tag, mp, vops, vpp)
/*
* Wait for available vnodes.
*/
- while (numvnodes > desiredvnodes) {
+ if (numvnodes > desiredvnodes) {
if (vnlruproc_sig == 0) {
vnlruproc_sig = 1; /* avoid unnecessary wakeups */
wakeup(vnlruproc);
}
msleep(&vnlruproc_sig, &vnode_free_list_mtx, PVFS,
"vlruwk", hz);
+ if (numvnodes > desiredvnodes)
+ return (ENFILE);
}
numvnodes++;
mtx_unlock(&vnode_free_list_mtx);
OpenPOWER on IntegriCloud