Hold the currently selected vnode's lock across the call to VOP_GETVOBJECT.

Don't try to create a vm object before the file system has a chance to finish
initializing it.  This is incorrect for a number of reasons.  Firstly, that
VOP requires a lock which the file system may not have initialized yet. Also,
open and others will create a vm object if it is necessary later.
This commit is contained in:
Jeff Roberson 2002-05-06 04:47:43 +00:00
parent 17b3efd432
commit 6953f5da1a

View File

@ -772,6 +772,8 @@ getnewvnode(tag, mp, vops, vpp)
panic("getnewvnode: free vnode isn't");
TAILQ_REMOVE(&vnode_free_list, vp, v_freelist);
if (vn_lock(vp, LK_EXCLUSIVE, td) != 0)
continue;
/*
* Don't recycle if we still have cached pages or if
* we cannot get the interlock.
@ -783,8 +785,10 @@ getnewvnode(tag, mp, vops, vpp)
TAILQ_INSERT_TAIL(&vnode_free_list, vp,
v_freelist);
vp = NULL;
VOP_UNLOCK(vp, 0, td);
continue;
}
VOP_UNLOCK(vp, 0, td);
if (LIST_FIRST(&vp->v_cache_src)) {
/*
* note: nameileafonly sysctl is temporary,
@ -891,8 +895,6 @@ getnewvnode(tag, mp, vops, vpp)
splx(s);
vfs_object_create(vp, td, td->td_ucred);
#if 0
vnodeallocs++;
if (vnodeallocs % vnoderecycleperiod == 0 &&