diff options
author | semenu <semenu@FreeBSD.org> | 2002-06-13 18:25:06 +0000 |
---|---|---|
committer | semenu <semenu@FreeBSD.org> | 2002-06-13 18:25:06 +0000 |
commit | 7e3005a305921f4ef318191154628c2723c3c2bf (patch) | |
tree | 00f39a8efe57dd5371cd3f460bc978cc373ac8c6 /sys/fs/nullfs/null_subr.c | |
parent | 7baa028f375f33f5042fc2e26feba46a7aa2115f (diff) | |
download | FreeBSD-src-7e3005a305921f4ef318191154628c2723c3c2bf.zip FreeBSD-src-7e3005a305921f4ef318191154628c2723c3c2bf.tar.gz |
Fix the "error" path (when dropping not fully initialized vnode).
Also move hash operations out of null_vnops.c and explicitly initialize
v_lock in null_node_alloc (to set wmesg).
Reviewed by: bp
MFC after: 2 weeks
Diffstat (limited to 'sys/fs/nullfs/null_subr.c')
-rw-r--r-- | sys/fs/nullfs/null_subr.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index add959e..5e1d7b3 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -183,10 +183,15 @@ null_node_alloc(mp, lowervp, vpp) } vp = *vpp; - vp->v_type = lowervp->v_type; xp->null_vnode = vp; - vp->v_data = xp; xp->null_lowervp = lowervp; + + vp->v_type = lowervp->v_type; + vp->v_data = xp; + + /* Though v_lock is inited by getnewvnode(), we want our own wmesg */ + lockinit(&vp->v_lock, PVFS, "nunode", VLKTIMEOUT, LK_NOPAUSE); + /* * Before we insert our new node onto the hash chains, * check to see if someone else has beaten us to it. @@ -194,9 +199,7 @@ null_node_alloc(mp, lowervp, vpp) */ othervp = null_node_find(mp, lowervp); if (othervp) { - vp->v_data = NULL; - FREE(xp, M_NULLFSNODE); - vp->v_type = VBAD; /* node is discarded */ + xp->null_lowervp = NULL; vrele(vp); *vpp = othervp; return 0; @@ -286,6 +289,17 @@ null_node_create(mp, lowervp, newvpp) return (0); } +void +null_hashrem(xp) + struct null_node *xp; +{ + struct thread *td = curthread; /* XXX */ + + lockmgr(&null_hashlock, LK_EXCLUSIVE, NULL, td); + LIST_REMOVE(xp, null_hash); + lockmgr(&null_hashlock, LK_RELEASE, NULL, td); +} + #ifdef DIAGNOSTIC #include "opt_ddb.h" |