From owner-svn-src-head@FreeBSD.ORG Sat Oct 2 16:04:50 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE696106564A; Sat, 2 Oct 2010 16:04:50 +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 CDF2D8FC0A; Sat, 2 Oct 2010 16:04:50 +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 o92G4o0W044418; Sat, 2 Oct 2010 16:04:50 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o92G4oCR044415; Sat, 2 Oct 2010 16:04:50 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201010021604.o92G4oCR044415@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 2 Oct 2010 16:04:50 +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: r213359 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Oct 2010 16:04:51 -0000 Author: kib Date: Sat Oct 2 16:04:50 2010 New Revision: 213359 URL: http://svn.freebsd.org/changeset/base/213359 Log: Release the vnode lock and close the linker file vnode earlier in the linker_load_file methods. The change is that the consequent linker_file_unload() call is not under the vnode lock anymore. This prevents the LOR between kernel linker sx xlock and vnode lock, because linker_file_unload() relocks kernel linker lock. MFC after: 2 weeks Modified: head/sys/kern/link_elf.c head/sys/kern/link_elf_obj.c Modified: head/sys/kern/link_elf.c ============================================================================== --- head/sys/kern/link_elf.c Sat Oct 2 11:45:18 2010 (r213358) +++ head/sys/kern/link_elf.c Sat Oct 2 16:04:50 2010 (r213359) @@ -967,15 +967,15 @@ nosyms: *result = lf; out: + VOP_UNLOCK(nd.ni_vp, 0); + vn_close(nd.ni_vp, FREAD, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); if (error && lf) linker_file_unload(lf, LINKER_UNLOAD_FORCE); if (shdr) free(shdr, M_LINKER); if (firstpage) free(firstpage, M_LINKER); - VOP_UNLOCK(nd.ni_vp, 0); - vn_close(nd.ni_vp, FREAD, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); return error; } Modified: head/sys/kern/link_elf_obj.c ============================================================================== --- head/sys/kern/link_elf_obj.c Sat Oct 2 11:45:18 2010 (r213358) +++ head/sys/kern/link_elf_obj.c Sat Oct 2 16:04:50 2010 (r213359) @@ -885,13 +885,13 @@ link_elf_load_file(linker_class_t cls, c *result = lf; out: + VOP_UNLOCK(nd.ni_vp, 0); + vn_close(nd.ni_vp, FREAD, td->td_ucred, td); + VFS_UNLOCK_GIANT(vfslocked); if (error && lf) linker_file_unload(lf, LINKER_UNLOAD_FORCE); if (hdr) free(hdr, M_LINKER); - VOP_UNLOCK(nd.ni_vp, 0); - vn_close(nd.ni_vp, FREAD, td->td_ucred, td); - VFS_UNLOCK_GIANT(vfslocked); return error; }