Date: Sat, 23 Apr 2011 21:38:21 +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: r220977 - head/sys/vm Message-ID: <201104232138.p3NLcLtM004651@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Sat Apr 23 21:38:21 2011 New Revision: 220977 URL: http://svn.freebsd.org/changeset/base/220977 Log: Fix two bugs in r218670. Hold the vnode around the region where object lock is dropped, until vnode lock is acquired. Do not drop the vnode reference for a case when the object was deallocated during unlock. Note that in this case, VV_TEXT is cleared by vnode_pager_dealloc(). Reported and tested by: pho Reviewed by: alc MFC after: 3 days Modified: head/sys/vm/vm_object.c Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sat Apr 23 21:02:25 2011 (r220976) +++ head/sys/vm/vm_object.c Sat Apr 23 21:38:21 2011 (r220977) @@ -443,14 +443,21 @@ vm_object_vndeallocate(vm_object_t objec /* vrele may need the vnode lock. */ vrele(vp); } else { + vhold(vp); VM_OBJECT_UNLOCK(object); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vdrop(vp); VM_OBJECT_LOCK(object); object->ref_count--; - if (object->ref_count == 0) - vp->v_vflag &= ~VV_TEXT; - VM_OBJECT_UNLOCK(object); - vput(vp); + if (object->type == OBJT_DEAD) { + VM_OBJECT_UNLOCK(object); + VOP_UNLOCK(vp, 0); + } else { + if (object->ref_count == 0) + vp->v_vflag &= ~VV_TEXT; + VM_OBJECT_UNLOCK(object); + vput(vp); + } } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201104232138.p3NLcLtM004651>