From bfe0870a5677e80b9c46e2321657e424a6a20614 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 6 May 2002 04:47:43 +0000 Subject: 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. --- sys/kern/vfs_subr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sys/kern/vfs_subr.c') diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 6ec9007..6e7a68c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -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 && -- cgit v1.1