- 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.
This commit is contained in:
parent
b308de8beb
commit
92b8231d4f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=144624
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user