summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2015-08-08 11:22:45 +0000
committermav <mav@FreeBSD.org>2015-08-08 11:22:45 +0000
commit4709c1446690915a243422427b5a1db3fff382a0 (patch)
tree98416b76c3ec6eea3902fbbc0f02fcf9cd3910a1
parent0fe044d6fdac6f0bb562cc7c9cc5d13038425034 (diff)
downloadFreeBSD-src-4709c1446690915a243422427b5a1db3fff382a0.zip
FreeBSD-src-4709c1446690915a243422427b5a1db3fff382a0.tar.gz
Don't panic if disk lost TRIM support due to switching to PIO mode.
MFC after: 1 week
-rw-r--r--sys/cam/ata/ata_da.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c
index f14f172..6f4b59b 100644
--- a/sys/cam/ata/ata_da.c
+++ b/sys/cam/ata/ata_da.c
@@ -767,10 +767,6 @@ adastrategy(struct bio *bp)
* Place it in the queue of disk activities for this disk
*/
if (bp->bio_cmd == BIO_DELETE) {
- KASSERT((softc->flags & ADA_FLAG_CAN_TRIM) ||
- ((softc->flags & ADA_FLAG_CAN_CFA) &&
- !(softc->flags & ADA_FLAG_CAN_48BIT)),
- ("BIO_DELETE but no supported TRIM method."));
bioq_disksort(&softc->trim_queue, bp);
} else {
if (ADA_SIO)
@@ -1544,7 +1540,14 @@ adastart(struct cam_periph *periph, union ccb *start_ccb)
!(softc->flags & ADA_FLAG_CAN_48BIT)) {
ada_cfaerase(softc, bp, ataio);
} else {
- panic("adastart: BIO_DELETE without method, not possible.");
+ /* This can happen if DMA was disabled. */
+ bioq_remove(&softc->trim_queue, bp);
+ bp->bio_error = EOPNOTSUPP;
+ bp->bio_flags |= BIO_ERROR;
+ biodone(bp);
+ xpt_release_ccb(start_ccb);
+ adaschedule(periph);
+ return;
}
softc->trim_running = 1;
start_ccb->ccb_h.ccb_state = ADA_CCB_TRIM;
OpenPOWER on IntegriCloud