Author: kib
Date: Sat Apr 23 21:38:21 2011
New Revision: 220977
URL: http://svn.freebsd.org/changeset/base/220977

Log:
  Fix two bugs in r218670.
  
  Hold the vnode around the region where object lock is dropped, until
  vnode lock is acquired.
  
  Do not drop the vnode reference for a case when the object was
  deallocated during unlock. Note that in this case, VV_TEXT is cleared
  by vnode_pager_dealloc().
  
  Reported and tested by:       pho
  Reviewed by:  alc
  MFC after:    3 days

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c     Sat Apr 23 21:02:25 2011        (r220976)
+++ head/sys/vm/vm_object.c     Sat Apr 23 21:38:21 2011        (r220977)
@@ -443,14 +443,21 @@ vm_object_vndeallocate(vm_object_t objec
                /* vrele may need the vnode lock. */
                vrele(vp);
        } else {
+               vhold(vp);
                VM_OBJECT_UNLOCK(object);
                vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+               vdrop(vp);
                VM_OBJECT_LOCK(object);
                object->ref_count--;
-               if (object->ref_count == 0)
-                       vp->v_vflag &= ~VV_TEXT;
-               VM_OBJECT_UNLOCK(object);
-               vput(vp);
+               if (object->type == OBJT_DEAD) {
+                       VM_OBJECT_UNLOCK(object);
+                       VOP_UNLOCK(vp, 0);
+               } else {
+                       if (object->ref_count == 0)
+                               vp->v_vflag &= ~VV_TEXT;
+                       VM_OBJECT_UNLOCK(object);
+                       vput(vp);
+               }
        }
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to