From owner-svn-src-head@FreeBSD.ORG Thu Feb 5 23:01:37 2009 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 23B3D1065675; Thu, 5 Feb 2009 23:01:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 121E48FC19; Thu, 5 Feb 2009 23:01:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n15N1aju041964; Thu, 5 Feb 2009 23:01:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n15N1a04041963; Thu, 5 Feb 2009 23:01:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200902052301.n15N1a04041963@svn.freebsd.org> From: John Baldwin Date: Thu, 5 Feb 2009 23:01:36 +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: r188209 - 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: Thu, 05 Feb 2009 23:01:37 -0000 Author: jhb Date: Thu Feb 5 23:01:36 2009 New Revision: 188209 URL: http://svn.freebsd.org/changeset/base/188209 Log: Drop the kernel linker lock while running SYSUNINIT routines and removing sysctls during a linker file unload. We drop the lock when doing similar operations during a linker file load. To close races, clear the LINKED flag before dropping the lock so that the linker file is no longer visible to userland. MFC after: 1 week Modified: head/sys/kern/kern_linker.c Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Thu Feb 5 22:19:13 2009 (r188208) +++ head/sys/kern/kern_linker.c Thu Feb 5 23:01:36 2009 (r188209) @@ -643,8 +643,11 @@ linker_file_unload(linker_file_t file, i * link error. */ if (file->flags & LINKER_FILE_LINKED) { + file->flags &= ~LINKER_FILE_LINKED; + KLD_UNLOCK(); linker_file_sysuninit(file); linker_file_unregister_sysctls(file); + KLD_LOCK(); } TAILQ_REMOVE(&linker_files, file, link);