aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/cam_xpt.c
diff options
context:
space:
mode:
authorKenneth D. Merry <ken@FreeBSD.org>1998-10-22 22:16:56 +0000
committerKenneth D. Merry <ken@FreeBSD.org>1998-10-22 22:16:56 +0000
commitee9c90c75ccfae31387e5a26108e4efee7f84844 (patch)
treed8b3bcb55a1be03971d9a5cdfe9c58c6e1bd9677 /sys/cam/cam_xpt.c
parent16c0b5195cae2394d27ba44d41b34d055a7161b4 (diff)
downloadsrc-ee9c90c75ccfae31387e5a26108e4efee7f84844.tar.gz
src-ee9c90c75ccfae31387e5a26108e4efee7f84844.zip
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
Notes
Notes: svn path=/head/; revision=40603
Diffstat (limited to 'sys/cam/cam_xpt.c')
-rw-r--r--sys/cam/cam_xpt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index fdd0de518a46..e3f86c0ce614 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: cam_xpt.c,v 1.23 1998/10/15 17:46:18 ken Exp $
+ * $Id: cam_xpt.c,v 1.24 1998/10/15 19:08:52 ken Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
@@ -1161,7 +1161,7 @@ xpt_init()
return;
}
- cam_periph_alloc(xptregister, NULL, NULL, "xpt", CAM_PERIPH_BIO,
+ cam_periph_alloc(xptregister, NULL, NULL, NULL, "xpt", CAM_PERIPH_BIO,
path, NULL, 0, NULL);
xpt_free_path(path);
@@ -4777,7 +4777,7 @@ xpt_scan_lun(struct cam_periph *periph, struct cam_path *path,
TAILQ_INSERT_TAIL(&softc->request_ccbs, &request_ccb->ccb_h,
periph_links.tqe);
} else {
- status = cam_periph_alloc(proberegister, probecleanup,
+ status = cam_periph_alloc(proberegister, NULL, probecleanup,
probestart, "probe",
CAM_PERIPH_BIO,
request_ccb->ccb_h.path, NULL, 0,