svn commit: r249531 - stable/9/sys/vm

Konstantin Belousov kib at FreeBSD.org
Tue Apr 16 06:17:16 UTC 2013


Author: kib
Date: Tue Apr 16 06:17:15 2013
New Revision: 249531
URL: http://svnweb.freebsd.org/changeset/base/249531

Log:
  MFC r249303:
  Fix the assertions for the state of the object under the map entry
  with the MAP_ENTRY_VN_WRITECNT flag.

Modified:
  stable/9/sys/vm/vm_map.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/vm/vm_map.c
==============================================================================
--- stable/9/sys/vm/vm_map.c	Tue Apr 16 05:57:16 2013	(r249530)
+++ stable/9/sys/vm/vm_map.c	Tue Apr 16 06:17:15 2013	(r249531)
@@ -3160,6 +3160,22 @@ vmspace_fork(struct vmspace *vm1, vm_oof
 				object->charge = old_entry->end - old_entry->start;
 				old_entry->cred = NULL;
 			}
+
+			/*
+			 * Assert the correct state of the vnode
+			 * v_writecount while the object is locked, to
+			 * not relock it later for the assertion
+			 * correctness.
+			 */
+			if (old_entry->eflags & MAP_ENTRY_VN_WRITECNT &&
+			    object->type == OBJT_VNODE) {
+				KASSERT(((struct vnode *)object->handle)->
+				    v_writecount > 0,
+				    ("vmspace_fork: v_writecount %p", object));
+				KASSERT(object->un_pager.vnp.writemappings > 0,
+				    ("vmspace_fork: vnp.writecount %p",
+				    object));
+			}
 			VM_OBJECT_UNLOCK(object);
 
 			/*
@@ -3171,12 +3187,6 @@ vmspace_fork(struct vmspace *vm1, vm_oof
 			    MAP_ENTRY_IN_TRANSITION);
 			new_entry->wired_count = 0;
 			if (new_entry->eflags & MAP_ENTRY_VN_WRITECNT) {
-				object = new_entry->object.vm_object;
-				KASSERT(((struct vnode *)object->handle)->
-				    v_writecount > 0,
-				    ("vmspace_fork: v_writecount"));
-				KASSERT(object->un_pager.vnp.writemappings > 0,
-				    ("vmspace_fork: vnp.writecount"));
 				vnode_pager_update_writecount(object,
 				    new_entry->start, new_entry->end);
 			}


More information about the svn-src-all mailing list