diff options
author | jeff <jeff@FreeBSD.org> | 2002-05-06 04:47:43 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-05-06 04:47:43 +0000 |
commit | bfe0870a5677e80b9c46e2321657e424a6a20614 (patch) | |
tree | 6783d38b366806111a89449835e817ee87f22cc5 | |
parent | 2a4292262e25e24b26f8919fa92465eaf087483c (diff) | |
download | FreeBSD-src-bfe0870a5677e80b9c46e2321657e424a6a20614.zip FreeBSD-src-bfe0870a5677e80b9c46e2321657e424a6a20614.tar.gz |
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.
-rw-r--r-- | sys/kern/vfs_subr.c | 6 |
1 files changed, 4 insertions, 2 deletions
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 && |