From owner-svn-src-all@FreeBSD.ORG Tue Apr 9 10:04:11 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 6BA62DD8; Tue, 9 Apr 2013 10:04:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 5CD7DE74; Tue, 9 Apr 2013 10:04:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r39A4APn052714; Tue, 9 Apr 2013 10:04:10 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r39A4AZ4052713; Tue, 9 Apr 2013 10:04:10 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201304091004.r39A4AZ4052713@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 9 Apr 2013 10:04:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249303 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Apr 2013 10:04:11 -0000 Author: kib Date: Tue Apr 9 10:04:10 2013 New Revision: 249303 URL: http://svnweb.freebsd.org/changeset/base/249303 Log: Fix the assertions for the state of the object under the map entry with the MAP_ENTRY_VN_WRITECNT flag: - Move the assertion that verifies the state of the v_writecount and vnp.writecount, under the block where the object is locked. - Check that the object type is OBJT_VNODE before asserting. Reported by: avg Reviewed by: alc MFC after: 1 week Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Tue Apr 9 09:15:26 2013 (r249302) +++ head/sys/vm/vm_map.c Tue Apr 9 10:04:10 2013 (r249303) @@ -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_WUNLOCK(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); }