freebsd-nq/sys
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
..
amd64 Introduce reserve_pv_entry() and use it in pmap_pv_demote_pde(). In order 2012-06-23 22:54:25 +00:00
arm Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
boot MFV: Update zlib to 1.2.7. 2012-06-21 21:47:08 +00:00
bsm
cam Fix a bug which causes a panic in daopen(). The panic is caused by 2012-06-24 04:29:03 +00:00
cddl Import Illumos revision 13736:9f1d48e1681f 2012-06-22 20:42:11 +00:00
compat Make sure that each va_start has one and only one matching va_end, 2012-05-29 01:48:06 +00:00
conf Unbreak options ZFS after r236884. 2012-06-23 14:43:25 +00:00
contrib Merge ACPICA 20120620. 2012-06-22 00:40:44 +00:00
crypto Add support for the extended FPU states on amd64, both for native 2012-01-21 17:45:27 +00:00
ddb Update the ddb and gdb backends for the new 'trace_thread' hook. 2012-04-12 21:34:58 +00:00
dev Fix a bug which causes a panic in daopen(). The panic is caused by 2012-06-24 04:29:03 +00:00
fs Enable deadlock avoidance code for NFS client. 2012-06-21 09:26:06 +00:00
gdb Update the ddb and gdb backends for the new 'trace_thread' hook. 2012-04-12 21:34:58 +00:00
geom Fix a bug which causes a panic in daopen(). The panic is caused by 2012-06-24 04:29:03 +00:00
gnu/fs Fix build: 2012-05-23 06:49:50 +00:00
i386 Commit changes missed from r237435. Properly calculate the signal 2012-06-22 16:05:56 +00:00
ia64 Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
isa
kern Move the code dealing with shared page into a dedicated 2012-06-23 10:15:23 +00:00
kgssapi
libkern Fix unloading of libiconv module. 2012-06-11 17:42:39 +00:00
mips Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
modules - Updated TOE support in the kernel. 2012-06-19 07:34:13 +00:00
net - Updated TOE support in the kernel. 2012-06-19 07:34:13 +00:00
net80211 Extend the radiotap code to be aware of the size of any extra vendor 2012-06-18 02:08:04 +00:00
netatalk Fix typos 2012-02-28 15:07:05 +00:00
netgraph Make radix lookup on src and dst flow addresses optional 2012-06-18 13:56:36 +00:00
netinet Fix interface matching by ipfw table 2012-06-23 12:40:24 +00:00
netinet6 Just add a comment to further investigate when being closer to that code 2012-06-22 21:26:35 +00:00
netipsec Add multi-FIB IPv6 support to the core network stack supplementing 2012-02-03 13:08:44 +00:00
netipx Convert all users of IF_ADDR_LOCK to use new locking macros that specify 2012-01-05 19:00:36 +00:00
netnatm
netncp Add characters mapping for codepages used in Germany. 2012-06-01 03:59:08 +00:00
netsmb When checking if file descriptor number is valid, explicitely check for 'fd' 2012-06-13 22:12:10 +00:00
nfs Add multi-FIB IPv6 support to the core network stack supplementing 2012-02-03 13:08:44 +00:00
nfsclient PR# 165923 reported intermittent write failures for dirty 2012-05-12 12:02:51 +00:00
nfsserver
nlm jwd@ reported a problem via email to freebsd-fs@ on Aug 25, 2011 2012-01-31 02:11:05 +00:00
ofed - Updated TOE support in the kernel. 2012-06-19 07:34:13 +00:00
opencrypto
pc98 Implement mechanism to export some kernel timekeeping data to 2012-06-22 07:06:40 +00:00
pci intpm: add ATI IXP400 pci id 2012-04-16 10:33:46 +00:00
powerpc Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
rpc
security Check vplabel for NULL before dereferencing it. Fixes a panic 2012-05-03 15:51:34 +00:00
sparc64 Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
sys Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
teken
tools Make vnode_if.awk parse vnode operations with underscores, like VOP_FOO_BAR. 2012-02-21 19:35:59 +00:00
ufs Fix unbounded-length malloc, controlled from usermode. The added check 2012-06-21 09:20:07 +00:00
vm - Add a comment explaining the locking of the cached pages pool held 2012-06-22 18:34:11 +00:00
x86 Make the wchar_t type machine dependent. 2012-06-24 04:15:58 +00:00
xdr
xen blkif interface comment cleanups. No functional changes 2012-02-29 17:47:01 +00:00
Makefile Add sys/ofed to the 'make cscope' target. 2012-03-20 18:05:15 +00:00