From owner-svn-src-all@FreeBSD.ORG Sun Feb 13 21:52:26 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91771106564A; Sun, 13 Feb 2011 21:52:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7FC8F8FC18; Sun, 13 Feb 2011 21:52:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1DLqQYj061756; Sun, 13 Feb 2011 21:52:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1DLqQ7x061754; Sun, 13 Feb 2011 21:52:26 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201102132152.p1DLqQ7x061754@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 13 Feb 2011 21:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218670 - head/sys/vm X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 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: Sun, 13 Feb 2011 21:52:26 -0000 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); } /*