Author: kib
Date: Sun Feb  7 10:51:17 2010
New Revision: 203607
URL: http://svn.freebsd.org/changeset/base/203607

Log:
  MFC r202529:
  vunref() the vnode in vm object deallocation code for OBJT_VNODE
  appropriate number of times to prevent possible vnode reference leak.

Modified:
  stable/8/sys/vm/vm_pageout.c
  stable/8/sys/vm/vnode_pager.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/vm/vm_pageout.c
==============================================================================
--- stable/8/sys/vm/vm_pageout.c        Sun Feb  7 10:44:44 2010        
(r203606)
+++ stable/8/sys/vm/vm_pageout.c        Sun Feb  7 10:51:17 2010        
(r203607)
@@ -951,6 +951,8 @@ rescan0:
                                                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);

Modified: stable/8/sys/vm/vnode_pager.c
==============================================================================
--- stable/8/sys/vm/vnode_pager.c       Sun Feb  7 10:44:44 2010        
(r203606)
+++ stable/8/sys/vm/vnode_pager.c       Sun Feb  7 10:51:17 2010        
(r203607)
@@ -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
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to