freebsd-dev/share
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
..
colldef Add lv_LV, move lt_LT to common part 2009-09-03 16:53:11 +00:00
dict Various changes from various sources: 2010-09-23 11:19:03 +00:00
doc The BIND 9.8.2 tarball was re-rolled to remove 9.8.1 release notes. 2012-04-12 01:53:33 +00:00
dtrace Fix a case typo. 2012-05-18 20:34:08 +00:00
examples Sync example file with mdoc changes made in rev 235450. 2012-06-13 19:08:00 +00:00
i18n Add the BSD-licensed Citrus iconv to the base system with default off 2011-02-25 00:04:39 +00:00
info
man Fix a bug which causes a panic in daopen(). The panic is caused by 2012-06-24 04:29:03 +00:00
me
misc Add pfg@ as one of my mentees. 2012-06-12 20:55:57 +00:00
mk In CTFCONVERT_CMD initialization, check that ${MAKE_VERSION} is defined 2012-06-16 16:51:42 +00:00
mklocale Add lv_LV, move lt_LT to common part 2009-09-03 17:12:45 +00:00
monetdef Fix the number of decimal digits used for Swiss Francs (0 -> 2). Found by the libc++ test suite. If there is some locale test suite somewhere, it might be worth running it... 2011-11-12 14:39:20 +00:00
msgdef Add lv_LV 2009-09-04 06:19:37 +00:00
numericdef Add lv_LV 2009-09-03 17:37:23 +00:00
security Remove stale references to utmp(5) and its corresponding filenames. 2010-01-21 17:25:12 +00:00
sendmail
skel Copy recent changes from etc/root/dot.cshrc that make the defaults more 2012-04-29 22:29:48 +00:00
snmp
syscons Add Spanish Dvorak keyboard model to syscons. 2012-05-10 23:38:34 +00:00
tabset
termcap General mdoc(7) and typo fixes. 2012-05-12 15:08:22 +00:00
timedef Partial fix for PR 91106. Correct the short weekday names. Done according to this poll https://bugzilla.redhat.com/show_bug.cgi?id=242296. This will not close the bug fully yet, as the month names are still not correctly in Genitive. More research on this topic will be done, as I'm suspecting a bug in the libc locale functions picking the month name from the wrong group. 2011-02-27 21:32:25 +00:00
zoneinfo Officially speaking, the zoneinfo data files are contributed data. 2010-02-25 06:44:16 +00:00
Makefile Add support for our own DTrace scripts and those from the DTraceToolkit 2012-05-18 16:40:15 +00:00
Makefile.inc