freebsd with flexible iflib nic queues
Go to file
Kenneth D. Merry c3fb2891f0 Fix a bug which causes a panic in daopen(). The panic is caused by
a da(4) instance going away while GEOM is still probing it.

In this case, the GEOM disk class instance has been created by
disk_create(), and the taste of the disk is queued in the GEOM
event queue.

While that event is queued, the da(4) instance goes away.  When the
open call comes into the da(4) driver, it dereferences the freed
(but non-NULL) peripheral pointer provided by GEOM, which results
in a panic.

The solution is to add a callback to the GEOM disk code that is
called when all of its resources are cleaned up.  This is
implemented inside GEOM by adding an optional callback that is
called when all consumers have detached from a provider, and the
provider is about to be deleted.

scsi_cd.c,
scsi_da.c:	In the register routine for the cd(4) and da(4)
		routines, acquire a reference to the CAM peripheral
		instance just before we call disk_create().

		Use the new GEOM disk d_gone() callback to register
		a callback (dadiskgonecb()/cddiskgonecb()) that
		decrements the peripheral reference count once GEOM
		has finished cleaning up its resources.

		In the cd(4) driver, clean up open and close
		behavior slightly.  GEOM makes sure we only get one
		open() and one close call, so there is no need to
		set an open flag and decrement the reference count
		if we are not the first open.

		In the cd(4) driver, use cam_periph_release_locked()
		in a couple of error scenarios to avoid extra mutex
		calls.

geom.h:		Add a new, optional, providergone callback that
		is called when a provider is about to be deleted.

geom_disk.h:	Add a new d_gone() callback to the GEOM disk
		interface.

		Bump the DISK_VERSION to version 2.  This probably
		should have been done after a couple of previous
		changes, especially the addition of the d_getattr()
		callback.

geom_disk.c:	Add a providergone callback for the disk class,
		g_disk_providergone(), that calls the user's
		d_gone() callback if it exists.

		Bump the DISK_VERSION to 2.

geom_subr.c:	In g_destroy_provider(), call the providergone
		callback if it has been provided.

		In g_new_geomf(), propagate the class's
		providergone callback to the new geom instance.

blkfront.c:	Callers of disk_create() are supposed to pass in
		DISK_VERSION, not an explicit disk API version
		number.  Update the blkfront driver to do that.

disk.9:		Update the disk(9) man page to include information
		on the new d_gone() callback, as well as the
		previously added d_getattr() callback, d_descr
		field, and HBA PCI ID fields.

MFC after:	5 days
2012-06-24 04:29:03 +00:00
bin Polish previous revision: if the fts_* routines have lstat()'ed the 2012-06-20 21:10:38 +00:00
cddl Do not remount ZFS dataset if changing canmount property to "on" and 2012-06-15 07:38:21 +00:00
contrib Bring a couple of fixes for gcc optimizations. 2012-06-21 16:49:20 +00:00
crypto Update the previous openssl fix. [12:01] 2012-05-30 12:01:28 +00:00
etc Only output a list of file systems that need to be dumped if the system 2012-06-20 20:01:51 +00:00
games Partial revert of previous commit as some of the changes were not 2012-05-10 12:46:12 +00:00
gnu Turn on TLS support for arm on here as it is supported since r231618/ 2012-06-14 20:27:28 +00:00
include Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
kerberos5 Centralize the specification of the krb5 build tools. 2012-06-01 21:26:28 +00:00
lib Merge changes from upstream libedit. 2012-06-22 18:01:22 +00:00
libexec Eliminate the static buffer used to read the first page of the mapped 2012-06-14 11:20:22 +00:00
release Remove dead code. 2012-06-12 15:32:14 +00:00
rescue Disable jail support in ifconfig when either building a rescue 2012-02-14 07:14:42 +00:00
sbin Change 'camcontrol defects' to first probe a drive to find out how much 2012-06-22 18:57:06 +00:00
secure Update the previous openssl fix. [12:01] 2012-05-30 12:01:28 +00:00
share Fix a bug which causes a panic in daopen(). The panic is caused by 2012-06-24 04:29:03 +00:00
sys Fix a bug which causes a panic in daopen(). The panic is caused by 2012-06-24 04:29:03 +00:00
tools Provide a mechanism to not clear out the work and output dirs when 2012-06-20 21:38:16 +00:00
usr.bin MFV: Update zlib to 1.2.7. 2012-06-21 21:47:08 +00:00
usr.sbin Merge ACPICA 20120620. 2012-06-22 00:40:44 +00:00
COPYRIGHT Happy 2012 to FreeBSD users in Samoa. 2011-12-31 04:38:04 +00:00
LOCKS
MAINTAINERS Add isci(4) driver for amd64 and i386 targets. 2012-01-31 19:38:18 +00:00
Makefile Assume a big-endian default on MIPS and drop the "eb" suffix from MACHINE_ARCH. 2012-03-29 02:54:35 +00:00
Makefile.inc1 Minor wording change. The previous commit message should have included: 2012-06-15 19:42:49 +00:00
ObsoleteFiles.inc Also remove /usr/share/examples/etc/auth.conf, which I didn't even 2012-06-13 16:40:47 +00:00
README Add the cddl/ directory. 2010-11-14 11:32:56 +00:00
UPDATING Introduce "feature flags" for ZFS pools (bump SPA version to 5000). 2012-06-11 11:35:22 +00:00

This is the top level of the FreeBSD source directory.  This file
was last revised on:
$FreeBSD$

For copyright information, please see the file COPYRIGHT in this
directory (additional copyright information also exists for some
sources in this tree - please see the specific source directories for
more information).

The Makefile in this directory supports a number of targets for
building components (or all) of the FreeBSD source tree, the most
commonly used one being ``world'', which rebuilds and installs
everything in the FreeBSD system from the source tree except the
kernel, the kernel-modules and the contents of /etc.  The ``world''
target should only be used in cases where the source tree has not
changed from the currently running version.  See:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html
for more information, including setting make(1) variables.

The ``buildkernel'' and ``installkernel'' targets build and install
the kernel and the modules (see below).  Please see the top of
the Makefile in this directory for more information on the
standard build targets and compile-time flags.

Building a kernel is a somewhat more involved process, documentation
for which can be found at:
   http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
And in the config(8) man page.
Note: If you want to build and install the kernel with the
``buildkernel'' and ``installkernel'' targets, you might need to build
world before.  More information is available in the handbook.

The sample kernel configuration files reside in the sys/<arch>/conf
sub-directory (assuming that you've installed the kernel sources), the
file named GENERIC being the one used to build your initial installation
kernel.  The file NOTES contains entries and documentation for all possible
devices, not just those commonly used.  It is the successor of the ancient
LINT file, but in contrast to LINT, it is not buildable as a kernel but a
pure reference and documentation file.


Source Roadmap:
---------------
bin		System/user commands.

cddl		Various commands and libraries under the Common Development
		and Distribution License.

contrib		Packages contributed by 3rd parties.

crypto		Cryptography stuff (see crypto/README).

etc		Template files for /etc.

games		Amusements.

gnu		Various commands and libraries under the GNU Public License.
		Please see gnu/COPYING* for more information.

include		System include files.

kerberos5	Kerberos5 (Heimdal) package.

lib		System libraries.

libexec		System daemons.

release		Release building Makefile & associated tools.

rescue		Build system for statically linked /rescue utilities.

sbin		System commands.

secure		Cryptographic libraries and commands.

share		Shared resources.

sys		Kernel sources.

tools		Utilities for regression testing and miscellaneous tasks.

usr.bin		User commands.

usr.sbin	System administration commands.


For information on synchronizing your source tree with one or more of
the FreeBSD Project's development branches, please see:

  http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/synching.html