From owner-svn-src-stable-7@FreeBSD.ORG Tue Nov 22 01:32:58 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A4FB1065672; Tue, 22 Nov 2011 01:32:58 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 301198FC13; Tue, 22 Nov 2011 01:32:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAM1Ww5G068375; Tue, 22 Nov 2011 01:32:58 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAM1Ww05068373; Tue, 22 Nov 2011 01:32:58 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201111220132.pAM1Ww05068373@svn.freebsd.org> From: Rick Macklem Date: Tue, 22 Nov 2011 01:32:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227810 - stable/7/sys/rpc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Nov 2011 01:32:58 -0000 Author: rmacklem Date: Tue Nov 22 01:32:57 2011 New Revision: 227810 URL: http://svn.freebsd.org/changeset/base/227810 Log: MFC: r227059 Both a crash reported on freebsd-current on Oct. 18 under the subject heading "mtx_lock() of destroyed mutex on NFS" and PR# 156168 appear to be caused by clnt_dg_destroy() closing down the socket prematurely. When to close down the socket is controlled by a reference count (cs_refs), but clnt_dg_create() checks for sb_upcall being non-NULL to decide if a new socket is needed. I believe the crashes were caused by the following race: clnt_dg_destroy() finds cs_refs == 0 and decides to delete socket clnt_dg_destroy() then loses race with clnt_dg_create() for acquisition of the SOCKBUF_LOCK() clnt_dg_create() finds sb_upcall != NULL and increments cs_refs to 1 clnt_dg_destroy() then acquires SOCKBUF_LOCK(), sets sb_upcall to NULL and destroys socket This patch fixes the above race by changing clnt_dg_destroy() so that it acquires SOCKBUF_LOCK() before testing cs_refs. This is a slightly modified patch for stable/7. It fixes the above race, although others still exist, since some patches such as r193272 cannot be MFC'd. Tested by: nonesuch at longcount.org (Mark Saad) PR: kern/156168 Modified: stable/7/sys/rpc/clnt_dg.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/rpc/clnt_dg.c ============================================================================== --- stable/7/sys/rpc/clnt_dg.c Tue Nov 22 00:35:30 2011 (r227809) +++ stable/7/sys/rpc/clnt_dg.c Tue Nov 22 01:32:57 2011 (r227810) @@ -811,18 +811,22 @@ clnt_dg_destroy(CLIENT *cl) while (cu->cu_threads) msleep(cu, &cs->cs_lock, 0, "rpcclose", 0); + mtx_unlock(&cs->cs_lock); + SOCKBUF_LOCK(&cu->cu_socket->so_rcv); + mtx_lock(&cs->cs_lock); cs->cs_refs--; if (cs->cs_refs == 0) { - mtx_destroy(&cs->cs_lock); - SOCKBUF_LOCK(&cu->cu_socket->so_rcv); + mtx_unlock(&cs->cs_lock); cu->cu_socket->so_upcallarg = NULL; cu->cu_socket->so_upcall = NULL; cu->cu_socket->so_rcv.sb_flags &= ~SB_UPCALL; SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv); + mtx_destroy(&cs->cs_lock); mem_free(cs, sizeof(*cs)); lastsocketref = TRUE; } else { mtx_unlock(&cs->cs_lock); + SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv); lastsocketref = FALSE; } From owner-svn-src-stable-7@FreeBSD.ORG Wed Nov 23 12:24:49 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97EBF1065743; Wed, 23 Nov 2011 12:24:49 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 87D978FC08; Wed, 23 Nov 2011 12:24:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pANCOn8w045583; Wed, 23 Nov 2011 12:24:49 GMT (envelope-from gjb@svn.freebsd.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pANCOne9045581; Wed, 23 Nov 2011 12:24:49 GMT (envelope-from gjb@svn.freebsd.org) Message-Id: <201111231224.pANCOne9045581@svn.freebsd.org> From: Glen Barber Date: Wed, 23 Nov 2011 12:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227882 - stable/7 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Nov 2011 12:24:49 -0000 Author: gjb (doc committer) Date: Wed Nov 23 12:24:48 2011 New Revision: 227882 URL: http://svn.freebsd.org/changeset/base/227882 Log: MFC r227769, 227770, 227771: - Add a note to src/Makefile that explains that 'rm' runs twice because thesecond invocation only needs to operate on files with the immutable flag set. - Fix the note in r227769 to be less specific to the immutable flag. - Replace 'chflags' with 'file flags' in a comment, since 'chflags'is a command, not a flag itself. Modified: stable/7/Makefile (contents, props changed) Modified: stable/7/Makefile ============================================================================== --- stable/7/Makefile Wed Nov 23 12:24:29 2011 (r227881) +++ stable/7/Makefile Wed Nov 23 12:24:48 2011 (r227882) @@ -139,10 +139,12 @@ buildworld: upgrade_checks # # In the following, the first 'rm' in a series will usually remove all # files and directories. If it does not, then there are probably some -# files with chflags set, so this unsets them and tries the 'rm' a +# files with file flags set, so this unsets them and tries the 'rm' a # second time. There are situations where this target will be cleaning # some directories via more than one method, but that duplication is -# needed to correctly handle all the possible situations. +# needed to correctly handle all the possible situations. Removing all +# files without file flags set in the first 'rm' instance saves time, +# because 'chflags' will need to operate on fewer files afterwards. # BW_CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} cleanworld: From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 25 16:54:18 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A433B106564A; Fri, 25 Nov 2011 16:54:18 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 934DC8FC14; Fri, 25 Nov 2011 16:54:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAPGsIPg051631; Fri, 25 Nov 2011 16:54:18 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAPGsIh8051629; Fri, 25 Nov 2011 16:54:18 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111251654.pAPGsIh8051629@svn.freebsd.org> From: Marius Strobl Date: Fri, 25 Nov 2011 16:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227975 - stable/7/share/man/man9 X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2011 16:54:18 -0000 Author: marius Date: Fri Nov 25 16:54:18 2011 New Revision: 227975 URL: http://svn.freebsd.org/changeset/base/227975 Log: MFC: r204602, r204650 - Add missing includes to make example "compilable". - Use NULL for pointer arguments instead of 0. Modified: stable/7/share/man/man9/driver.9 Directory Properties: stable/7/share/man/man9/ (props changed) Modified: stable/7/share/man/man9/driver.9 ============================================================================== --- stable/7/share/man/man9/driver.9 Fri Nov 25 16:54:16 2011 (r227974) +++ stable/7/share/man/man9/driver.9 Fri Nov 25 16:54:18 2011 (r227975) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 16, 1998 +.Dd March 3, 2010 .Dt DRIVER 9 .Os .Sh NAME @@ -37,7 +37,9 @@ .Sh SYNOPSIS .Bd -literal #include +#include #include +#include static int foo_probe(device_t); static int foo_attach(device_t); @@ -59,7 +61,7 @@ static device_method_t foo_methods[] = { { 0, 0 } }; -static driver_t foo_driver { +static driver_t foo_driver = { "foo", foo_methods, sizeof(struct foo_softc) @@ -67,7 +69,7 @@ static driver_t foo_driver { static devclass_t foo_devclass; -DRIVER_MODULE(foo, bogo, foo_driver, foo_devclass, 0, 0); +DRIVER_MODULE(foo, bogo, foo_driver, foo_devclass, NULL, NULL); .Ed .Sh DESCRIPTION Each driver in the kernel is described by a From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 25 17:08:40 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33FC9106588F; Fri, 25 Nov 2011 17:08:39 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A61E88FC0A; Fri, 25 Nov 2011 17:08:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAPH8dxP052277; Fri, 25 Nov 2011 17:08:39 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAPH8dAM052273; Fri, 25 Nov 2011 17:08:39 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111251708.pAPH8dAM052273@svn.freebsd.org> From: Marius Strobl Date: Fri, 25 Nov 2011 17:08:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227979 - in stable/7: share/examples/drivers share/man/man9 sys/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2011 17:08:40 -0000 Author: marius Date: Fri Nov 25 17:08:39 2011 New Revision: 227979 URL: http://svn.freebsd.org/changeset/base/227979 Log: MFC: r227829, r227844 - Add a DEVMETHOD_END alias for KOBJMETHOD_END so that along with 'driver_t' and DEVMETHOD() we can fully hide the explicit mention of kobj(9) from device drivers. - Update the device driver examples to use DEVMETHOD_END. Submitted by: jhb Modified: stable/7/share/examples/drivers/make_device_driver.sh stable/7/share/man/man9/driver.9 stable/7/sys/sys/bus.h Directory Properties: stable/7/share/examples/ (props changed) stable/7/share/man/man9/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/share/examples/drivers/make_device_driver.sh ============================================================================== --- stable/7/share/examples/drivers/make_device_driver.sh Fri Nov 25 17:08:33 2011 (r227978) +++ stable/7/share/examples/drivers/make_device_driver.sh Fri Nov 25 17:08:39 2011 (r227979) @@ -261,7 +261,7 @@ static device_method_t ${1}_methods[] = DEVMETHOD(device_probe, ${1}_isa_probe), DEVMETHOD(device_attach, ${1}_isa_attach), DEVMETHOD(device_detach, ${1}_isa_detach), - { 0, 0 } + DEVMETHOD_END }; static driver_t ${1}_isa_driver = { Modified: stable/7/share/man/man9/driver.9 ============================================================================== --- stable/7/share/man/man9/driver.9 Fri Nov 25 17:08:33 2011 (r227978) +++ stable/7/share/man/man9/driver.9 Fri Nov 25 17:08:39 2011 (r227979) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 3, 2010 +.Dd November 22, 2011 .Dt DRIVER 9 .Os .Sh NAME @@ -58,7 +58,7 @@ static device_method_t foo_methods[] = { DEVMETHOD(bogo_twiddle, foo_twiddle), /* Terminate method list */ - { 0, 0 } + DEVMETHOD_END }; static driver_t foo_driver = { Modified: stable/7/sys/sys/bus.h ============================================================================== --- stable/7/sys/sys/bus.h Fri Nov 25 17:08:33 2011 (r227978) +++ stable/7/sys/sys/bus.h Fri Nov 25 17:08:39 2011 (r227979) @@ -521,9 +521,10 @@ void bus_data_generation_update(void); #define BUS_PROBE_NOWILDCARD (-2000000000) /* No wildcard device matches */ /** - * Shorthand for constructing method tables. + * Shorthands for constructing method tables. */ #define DEVMETHOD KOBJMETHOD +#define DEVMETHOD_END KOBJMETHOD_END /* * Some common device interfaces. From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 26 16:38:49 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BAE9106566B; Sat, 26 Nov 2011 16:38:49 +0000 (UTC) (envelope-from wblock@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 815328FC21; Sat, 26 Nov 2011 16:38:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAQGcnXe000329; Sat, 26 Nov 2011 16:38:49 GMT (envelope-from wblock@svn.freebsd.org) Received: (from wblock@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAQGcn3p000327; Sat, 26 Nov 2011 16:38:49 GMT (envelope-from wblock@svn.freebsd.org) Message-Id: <201111261638.pAQGcn3p000327@svn.freebsd.org> From: Warren Block Date: Sat, 26 Nov 2011 16:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228001 - stable/7/etc X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Nov 2011 16:38:49 -0000 Author: wblock (doc committer) Date: Sat Nov 26 16:38:49 2011 New Revision: 228001 URL: http://svn.freebsd.org/changeset/base/228001 Log: MFC r225861: Fix a confusing sentence. Other wording tweaks. Approved by: gjb (mentor) Modified: stable/7/etc/devd.conf Directory Properties: stable/7/etc/ (props changed) Modified: stable/7/etc/devd.conf ============================================================================== --- stable/7/etc/devd.conf Sat Nov 26 16:38:16 2011 (r228000) +++ stable/7/etc/devd.conf Sat Nov 26 16:38:49 2011 (r228001) @@ -8,10 +8,10 @@ # NB: device-name is shorthand for 'match device-name' options { - # Each directory directive adds a directory the list of directories - # that we scan for files. Files are read-in in the order that they - # are returned from readdir(3). The rule-sets are combined to - # create a DFA that's used to match events to actions. + # Each "directory" directive adds a directory to the list of + # directories that we scan for files. Files are loaded in the order + # that they are returned from readdir(3). The rule-sets are combined + # to create a DFA that's used to match events to actions. directory "/etc/devd"; directory "/usr/local/etc/devd"; pid-file "/var/run/devd.pid"; @@ -44,7 +44,7 @@ notify 0 { }; # -# Try to start dhclient on Ethernet like interfaces when the link comes +# Try to start dhclient on Ethernet-like interfaces when the link comes # up. Only devices that are configured to support DHCP will actually # run it. No link down rule exists because dhclient automatically exits # when the link goes down. @@ -88,7 +88,7 @@ detach 100 { device-name "ed50"; }; -# When a USB Bluetooth dongle appears activate it +# When a USB Bluetooth dongle appears, activate it attach 100 { device-name "ubt[0-9]+"; action "/etc/rc.d/bluetooth quietstart $device-name"; @@ -116,7 +116,7 @@ attach 100 { }; # Firmware download into the ActiveWire board. After the firmware download is -# done the device detaches and reappears as something new and shiny +# done, the device detaches and reappears as something new and shiny # automatically. attach 100 { match "vendor" "0x0854"; @@ -276,12 +276,11 @@ notify 0 { /* EXAMPLES TO END OF FILE -# The following might be an example of something that a vendor might -# install if you were to add their device. This might reside in -# /usr/local/etc/devd/deqna.conf. A deqna is, in this hypothetical -# example, a pccard ethernet-like device. Students of history may -# know other devices by this name, and will get the in-jokes in this -# entry. +# An example of something that a vendor might install if you were to +# add their device. This might reside in /usr/local/etc/devd/deqna.conf. +# A deqna is, in this hypothetical example, a pccard ethernet-like device. +# Students of history may know other devices by this name, and will get +# the in-jokes in this entry. nomatch 10 { match "bus" "pccard[0-9]+"; match "manufacturer" "0x1234"; @@ -299,7 +298,7 @@ detach 10 { # Examples of notify hooks. A notify is a generic way for a kernel # subsystem to send event notification to userland. -# + # Here are some examples of ACPI notify handlers. ACPI subsystems that # generate notifies include the AC adapter, power/sleep buttons, # control method batteries, lid switch, and thermal zones.