diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index d3963febed54..1710ad176bb1 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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);