Date: Sun, 20 Feb 2011 09:17:59 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r218880 - stable/8/sys/vm Message-ID: <201102200918.p1K9I0wZ026309@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sun Feb 20 09:17:59 2011 New Revision: 218880 URL: http://svn.freebsd.org/changeset/base/218880 Log: MFC r218670: Lock the vnode around clearing of VV_TEXT flag. Remove mp_fixme() note mentioning that vnode lock is needed. Modified: stable/8/sys/vm/vm_object.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/vm/vm_object.c ============================================================================== --- stable/8/sys/vm/vm_object.c Sun Feb 20 07:58:30 2011 (r218879) +++ stable/8/sys/vm/vm_object.c Sun Feb 20 09:17:59 2011 (r218880) @@ -441,16 +441,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?201102200918.p1K9I0wZ026309>