freebsd-skq/sys/cam/scsi
Kenneth D. Merry 8900f4b872 Fix a race condition in CAM peripheral free handling, locking
in the CAM XPT bus traversal code, and a number of other periph level
issues.

cam_periph.h,
cam_periph.c:	Modify cam_periph_acquire() to test the CAM_PERIPH_INVALID
		flag prior to allowing a reference count to be gained
		on a peripheral.  Callers of this function will receive
		CAM_REQ_CMP_ERR status in the situation of attempting to
		reference an invalidated periph.  This guarantees that
		a peripheral scheduled for a deferred free will not
		be accessed during its wait for destruction.

		Panic during attempts to drop a reference count on
		a peripheral that already has a zero reference count.

		In cam_periph_list(), use a local sbuf with SBUF_FIXEDLEN
		set so that mallocs do not occur while the xpt topology
		lock is held, regardless of the allocation policy of the
		passed in sbuf.

		Add a new routine, cam_periph_release_locked_buses(),
		that can be called when the caller already holds
		the CAM topology lock.

		Add some extra debugging for duplicate peripheral
		allocations in cam_periph_alloc().

		Treat CAM_DEV_NOT_THERE much the same as a selection
		timeout (AC_LOST_DEVICE is emitted), but forgo retries.

cam_xpt.c:      Revamp the way the EDT traversal code does locking
		and reference counting.  This was broken, since it
		assumed that the EDT would not change during
		traversal, but that assumption is no longer valid.

		So, to prevent devices from going away while we
		traverse the EDT, make sure we properly lock
		everything and hold references on devices that
		we are using.

		The two peripheral driver traversal routines should
		be examined.  xptpdperiphtraverse() holds the
		topology lock for the entire time it runs.
		xptperiphtraverse() is now locked properly, but
		only holds the topology lock while it is traversing
		the list, and not while the traversal function is
		running.

		The bus locking code in xptbustraverse() should
		also be revisited at a later time, since it is
		complex and should probably be simplified.

scsi_da.c:	Pay attention to the return value from cam_periph_acquire().

		Return 0 always from daclose() even if the disk is now gone.

		Add some rudimentary error injection support.

scsi_sg.c:	Fix reference counting in the sg(4) driver.

		The sg driver was calling cam_periph_release() on close,
		but never called cam_periph_acquire() (which increments
		the reference count) on open.

		The periph code correctly complained that the sg(4)
		driver was trying to decrement the refcount when it
		was already 0.

Sponsored by:	Spectra Logic
MFC after:	2 weeks
2012-01-12 00:41:48 +00:00
..
scsi_all.c Add the CAM Target Layer (CTL). 2012-01-12 00:34:33 +00:00
scsi_all.h Add the CAM Target Layer (CTL). 2012-01-12 00:34:33 +00:00
scsi_cd.c Add support for CDRIOCGETBLOCKSIZE and CDRIOCSETBLOCKSIZE IOCTLs to control 2012-01-03 17:04:09 +00:00
scsi_cd.h
scsi_ch.c Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
scsi_ch.h - fix duplicate "a a" in some comments 2011-11-13 17:06:33 +00:00
scsi_da.c Fix a race condition in CAM peripheral free handling, locking 2012-01-12 00:41:48 +00:00
scsi_da.h Add the CAM Target Layer (CTL). 2012-01-12 00:34:33 +00:00
scsi_dvcfg.h
scsi_iu.h
scsi_low_pisa.c
scsi_low_pisa.h
scsi_low.c Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs. 2011-11-07 06:44:47 +00:00
scsi_low.h Add a new 'why' argument to kdb_enter(), and a set of constants to use 2007-12-25 17:52:02 +00:00
scsi_message.h
scsi_pass.c Plumb device physical path reporting from CAM devices, through GEOM and 2011-06-14 17:10:32 +00:00
scsi_pass.h
scsi_pt.c Make CAM report devices with ATA/SATA transport to devstat(9) as IDE. 2011-04-14 21:25:32 +00:00
scsi_pt.h
scsi_sa.c Remove unneeded checks for CAM_DEV_QFRZN after cam_periph_runccb() call. 2012-01-02 17:02:45 +00:00
scsi_sa.h
scsi_ses.c Remove unneeded checks for CAM_DEV_QFRZN after cam_periph_runccb() call. 2012-01-02 17:02:45 +00:00
scsi_ses.h Change new constant names to ones used by OpenSolaris. 2011-05-27 03:44:47 +00:00
scsi_sg.c Fix a race condition in CAM peripheral free handling, locking 2012-01-12 00:41:48 +00:00
scsi_sg.h
scsi_targ_bh.c Add the CAM Target Layer (CTL). 2012-01-12 00:34:33 +00:00
scsi_target.c Change targ(4) to use cdevpriv, instead of multiple character devices. 2011-12-13 21:26:33 +00:00
scsi_targetio.h
scsi_xpt.c Do not use the sometimes-reserved work 'bool' for a variable name. 2011-12-12 18:43:18 +00:00
smp_all.c Add Serial Management Protocol (SMP) passthrough support to CAM. 2010-11-30 22:39:46 +00:00
smp_all.h Add Serial Management Protocol (SMP) passthrough support to CAM. 2010-11-30 22:39:46 +00:00