Date: Sun, 13 Feb 2011 21:52:26 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r218670 - head/sys/vm Message-ID: <201102132152.p1DLqQ7x061754@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); } /*
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201102132152.p1DLqQ7x061754>