MFC r202529:

vunref() the vnode in vm object deallocation code for OBJT_VNODE
appropriate number of times to prevent possible vnode reference leak.
This commit is contained in:
Konstantin Belousov 2010-02-07 10:51:17 +00:00
parent e9560b4089
commit 02d65815cb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/stable/8/; revision=203607
2 changed files with 8 additions and 1 deletions

View File

@ -951,6 +951,8 @@ vm_pageout_scan(int pass)
vnodes_skipped++;
goto unlock_and_continue;
}
KASSERT(mp != NULL,
("vp %p with NULL v_mount", vp));
vm_page_unlock_queues();
vm_object_reference_locked(object);
VM_OBJECT_UNLOCK(object);

View File

@ -250,13 +250,16 @@ static void
vnode_pager_dealloc(object)
vm_object_t object;
{
struct vnode *vp = object->handle;
struct vnode *vp;
int refs;
vp = object->handle;
if (vp == NULL)
panic("vnode_pager_dealloc: pager already dealloced");
VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
vm_object_pip_wait(object, "vnpdea");
refs = object->ref_count;
object->handle = NULL;
object->type = OBJT_DEAD;
@ -267,6 +270,8 @@ vnode_pager_dealloc(object)
ASSERT_VOP_ELOCKED(vp, "vnode_pager_dealloc");
vp->v_object = NULL;
vp->v_vflag &= ~VV_TEXT;
while (refs-- > 0)
vunref(vp);
}
static boolean_t