Author: kib
Date: Sun Feb 13 21:52:26 2011
New Revision: 218670
URL: http://svn.freebsd.org/changeset/base/218670

Log:
  Lock the vnode around clearing of VV_TEXT flag. Remove mp_fixme() note
  mentioning that vnode lock is needed.
  
  Reviewed by:  alc
  Tested by:    pho
  MFC after:    1 week

Modified:
  head/sys/vm/vm_object.c

Modified: head/sys/vm/vm_object.c
==============================================================================
--- head/sys/vm/vm_object.c     Sun Feb 13 21:12:05 2011        (r218669)
+++ head/sys/vm/vm_object.c     Sun Feb 13 21:52:26 2011        (r218670)
@@ -437,16 +437,21 @@ vm_object_vndeallocate(vm_object_t objec
        }
 #endif
 
-       object->ref_count--;
-       if (object->ref_count == 0) {
-               mp_fixme("Unlocked vflag access.");
-               vp->v_vflag &= ~VV_TEXT;
+       if (object->ref_count > 1) {
+               object->ref_count--;
+               VM_OBJECT_UNLOCK(object);
+               /* vrele may need the vnode lock. */
+               vrele(vp);
+       } else {
+               VM_OBJECT_UNLOCK(object);
+               vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
+               VM_OBJECT_LOCK(object);
+               object->ref_count--;
+               if (object->ref_count == 0)
+                       vp->v_vflag &= ~VV_TEXT;
+               VM_OBJECT_UNLOCK(object);
+               vput(vp);
        }
-       VM_OBJECT_UNLOCK(object);
-       /*
-        * vrele may need a vop lock
-        */
-       vrele(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