summaryrefslogtreecommitdiffstats
path: root/sys/cam/scsi/scsi_target.c
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>1998-10-22 22:16:56 +0000
committerken <ken@FreeBSD.org>1998-10-22 22:16:56 +0000
commit123c4e574210364558b003c3b4308600a6cbdf16 (patch)
tree37676d718bb5ecd358f7101d2d5f0f9d60810f82 /sys/cam/scsi/scsi_target.c
parentc4aa0cf6f77d3320883b9363e359ae996632fb1a (diff)
downloadFreeBSD-src-123c4e574210364558b003c3b4308600a6cbdf16.zip
FreeBSD-src-123c4e574210364558b003c3b4308600a6cbdf16.tar.gz
Fix a problem with the way we handled device invalidation when attaching
to a device failed. In theory, the same steps that happen when we get an AC_LOST_DEVICE async notification should have been taken when a driver fails to attach. In practice, that wasn't the case. This only affected the da, cd and ch drivers, but the fix affects all peripheral drivers. There were several possible problems: - In the da driver, we didn't remove the peripheral's softc from the da driver's linked list of softcs. Once the peripheral and softc got removed, we'd get a kernel panic the next time the timeout routine called dasendorderedtag(). - In the da, cd and possibly ch drivers, we didn't remove the peripheral's devstat structure from the devstat queue. Once the peripheral and softc were removed, this could cause a panic if anyone tried to access device statistics. (one component of the linked list wouldn't exist anymore) - In the cd driver, we didn't take the peripheral off the changer run queue if it was scheduled to run. In practice, it's highly unlikely, and maybe impossible that the peripheral would have been on the changer run queue at that stage of the probe process. The fix is: - Add a new peripheral callback function (the "oninvalidate" function) that is called the first time cam_periph_invalidate() is called for a peripheral. - Create new foooninvalidate() routines for each peripheral driver. This routine is always called at splsoftcam(), and contains all the stuff that used to be in the AC_LOST_DEVICE case of the async callback handler. - Move the devstat cleanup call to the destructor/cleanup routines, since some of the drivers do I/O in their close routines. - Make sure that when we're flushing the buffer queue, we traverse it at splbio(). - Add a check for the invalid flag in the pt driver's open routine. Reviewed by: gibbs
Diffstat (limited to 'sys/cam/scsi/scsi_target.c')
-rw-r--r--sys/cam/scsi/scsi_target.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/cam/scsi/scsi_target.c b/sys/cam/scsi/scsi_target.c
index 4c50f14..a1960de 100644
--- a/sys/cam/scsi/scsi_target.c
+++ b/sys/cam/scsi/scsi_target.c
@@ -25,7 +25,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: scsi_target.c,v 1.1 1998/09/15 06:36:34 gibbs Exp $
+ * $Id: scsi_target.c,v 1.2 1998/09/15 22:05:42 gibbs Exp $
*/
#include <stddef.h> /* For offsetof */
@@ -261,7 +261,7 @@ targasync(void *callback_arg, u_int32_t code,
"due to status 0x%x\n", status);
break;
}
- status = cam_periph_alloc(targctor, targdtor, targstart,
+ status = cam_periph_alloc(targctor, NULL, targdtor, targstart,
"targ", CAM_PERIPH_BIO,
new_path, targasync,
AC_PATH_REGISTERED,
OpenPOWER on IntegriCloud