Author: mav
Date: Sat Aug 15 11:05:44 2015
New Revision: 286800
URL: https://svnweb.freebsd.org/changeset/base/286800

Log:
  MFC r286447:
  Don't panic if disk lost TRIM support due to switching to PIO mode.

Modified:
  stable/10/sys/cam/ata/ata_da.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ata/ata_da.c
==============================================================================
--- stable/10/sys/cam/ata/ata_da.c      Sat Aug 15 09:00:36 2015        
(r286799)
+++ stable/10/sys/cam/ata/ata_da.c      Sat Aug 15 11:05:44 2015        
(r286800)
@@ -760,10 +760,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)
@@ -1537,7 +1533,14 @@ adastart(struct cam_periph *periph, unio
                            !(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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to