Add a bandaid to avoid a deadlock in a situation, when we are trying to suspend

a file system, but need to obtain a vnode. We may not be able to do it, because
all vnodes could be already in use and other processes cannot release them,
because they are waiting in "suspfs" state.

In such situation, we allow to allocate a vnode anyway.

This is a temporary fix - there is no backpressure to free vnodes allocated in
those circumstances.

MFC after:	1 week
Reviewed by:	tegge
This commit is contained in:
Pawel Jakub Dawidek 2006-08-09 12:47:30 +00:00
parent 98a746cfe3
commit 13c85d339d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161122

View File

@ -869,6 +869,15 @@ getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops,
* Wait for available vnodes.
*/
if (numvnodes > desiredvnodes) {
if (mp->mnt_kern_flag & MNTK_SUSPEND) {
/*
* File system is beeing suspended, we cannot risk a
* deadlock here, so allocate new vnode anyway.
*/
if (freevnodes > wantfreevnodes)
vnlru_free(freevnodes - wantfreevnodes);
goto alloc;
}
if (vnlruproc_sig == 0) {
vnlruproc_sig = 1; /* avoid unnecessary wakeups */
wakeup(vnlruproc);
@ -882,6 +891,7 @@ getnewvnode(const char *tag, struct mount *mp, struct vop_vector *vops,
}
#endif
}
alloc:
numvnodes++;
mtx_unlock(&vnode_free_list_mtx);
vp = (struct vnode *) uma_zalloc(vnode_zone, M_WAITOK|M_ZERO);