diff options
author | mjacob <mjacob@FreeBSD.org> | 2010-08-17 17:11:15 +0000 |
---|---|---|
committer | mjacob <mjacob@FreeBSD.org> | 2010-08-17 17:11:15 +0000 |
commit | 6ed7860b674397db1944f1573e52975cea9a54ea (patch) | |
tree | bbfd516a3dfb806385cb7c336801afbfb27e9fe4 /sys/cam | |
parent | d8e2e27165e72af01c626085249abf380be4ca9c (diff) | |
download | FreeBSD-src-6ed7860b674397db1944f1573e52975cea9a54ea.zip FreeBSD-src-6ed7860b674397db1944f1573e52975cea9a54ea.tar.gz |
Now is as good a time as any to find out if we induce breakage
by issueing aborts for any pending commands when we're decommssioning
a disk.
MFC after: 3 months
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_da.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 8f64361..0bf175a 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -958,6 +958,8 @@ dainit(void) static void daoninvalidate(struct cam_periph *periph) { + struct ccb_abort cab; + struct ccb_hdr *ccb_h, *ccb_h_t; struct da_softc *softc; softc = (struct da_softc *)periph->softc; @@ -967,15 +969,29 @@ daoninvalidate(struct cam_periph *periph) */ xpt_register_async(0, daasync, periph, periph->path); + /* + * Invalidate the pack label + */ softc->flags |= DA_FLAG_PACK_INVALID; /* * Return all queued I/O with ENXIO. - * XXX Handle any transactions queued to the card - * with XPT_ABORT_CCB. */ bioq_flush(&softc->bio_queue, NULL, ENXIO); + /* + * Issue aborts for any pending commands. + */ + xpt_setup_ccb(&cab.ccb_h, periph->path, CAM_PRIORITY_NORMAL+1); + cab.ccb_h.func_code = XPT_ABORT; + LIST_FOREACH_SAFE(ccb_h, &softc->pending_ccbs, periph_links.le, ccb_h_t) { + cab.abort_ccb = (union ccb *)ccb_h; + xpt_action((union ccb *)&cab); + } + + /* + * This disk is *history*.... + */ disk_gone(softc->disk); xpt_print(periph->path, "lost device\n"); } |