Fix wrong locking in null_inactive and null_reclaim. This makes nullfs

relatively working back.

Reviewed by:	mckusick, bp
This commit is contained in:
Semen Ustimenko 2002-06-13 17:30:40 +00:00
parent 26101425e5
commit ebe0bdddac

View File

@ -715,13 +715,16 @@ null_inactive(ap)
} */ *ap;
{
struct vnode *vp = ap->a_vp;
struct thread *td = ap->a_td;
VOP_UNLOCK(vp, 0, td);
/*
* If this is the last reference, then free up the vnode
* so as not to tie up the lower vnodes.
*/
if (vp->v_usecount == 0)
vrecycle(vp, NULL, ap->a_td);
vrecycle(vp, NULL, td);
return (0);
}
@ -746,18 +749,12 @@ null_reclaim(ap)
LIST_REMOVE(xp, null_hash);
lockmgr(&null_hashlock, LK_RELEASE, NULL, td);
xp->null_lowervp = NULLVP;
if (vp->v_vnlock != NULL) {
vp->v_vnlock = &vp->v_lock; /* we no longer share the lock */
} else
VOP_UNLOCK(vp, LK_THISLAYER, td);
/*
* Now it is safe to drop references to the lower vnode.
* VOP_INACTIVE() will be called by vrele() if necessary.
*/
vput(lowervp);
vrele (lowervp);
vrele(lowervp);
vrele(lowervp);
vdata = vp->v_data;
vp->v_data = NULL;