Subject: CVS commit: src/sys/dev/scsipi
To: None <source-changes@NetBSD.org>
From: Manuel Bouyer <bouyer@netbsd.org>
List: source-changes
Date: 08/05/2004 19:45:13
Module Name:	src
Committed By:	bouyer
Date:		Thu Aug  5 19:45:13 UTC 2004

Modified Files:
	src/sys/dev/scsipi: scsi_base.c scsiconf.c

Log Message:
scsi_kill_pending(): don't kill the commands in periph_xferq here.
The controller is handling them, calling scsipi_done() here will end up in the
xfer being scsipi_done()'ed a second time when it completes in the controller
code. In addition, the way the loop was done here would end up in an infinite
loop, because the channel kernel thread needs to run to remove a command from
this queue.

scsibusdetach(): scsipi_done() all commands from periph_xferq. The controller
is already gone, and these commands will never complete.
Shut down the channel (which will cause the kenrel thread to exit) after
detaching the childs, as they will need the kernel thread for
scsipi_wait_drain().

Fix kernel hang or deadlock when detaching devices (either by scsictl detach
or unplug) with active commands.


To generate a diff of this commit:
cvs rdiff -r1.77 -r1.78 src/sys/dev/scsipi/scsi_base.c
cvs rdiff -r1.220 -r1.221 src/sys/dev/scsipi/scsiconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.