Page MenuHomeFreeBSD

D33228.diff
No OneTemporary

D33228.diff

diff --git a/sys/dev/mps/mps_sas.c b/sys/dev/mps/mps_sas.c
--- a/sys/dev/mps/mps_sas.c
+++ b/sys/dev/mps/mps_sas.c
@@ -235,8 +235,6 @@
void
mpssas_free_tm(struct mps_softc *sc, struct mps_command *tm)
{
- int target_id = 0xFFFFFFFF;
-
if (tm == NULL)
return;
@@ -245,13 +243,11 @@
* free the resources used for freezing the devq. Must clear the
* INRESET flag as well or scsi I/O will not work.
*/
- if (tm->cm_targ != NULL) {
- tm->cm_targ->flags &= ~MPSSAS_TARGET_INRESET;
- target_id = tm->cm_targ->tid;
- }
if (tm->cm_ccb) {
- mps_dprint(sc, MPS_INFO, "Unfreezing devq for target ID %d\n",
- target_id);
+ mps_dprint(sc, MPS_XINFO | MPS_RECOVERY,
+ "Unfreezing devq for target ID %d\n",
+ tm->cm_targ->tid);
+ tm->cm_targ->flags &= ~MPSSAS_TARGET_INRESET;
xpt_release_devq(tm->cm_ccb->ccb_h.path, 1, TRUE);
xpt_free_path(tm->cm_ccb->ccb_h.path);
xpt_free_ccb(tm->cm_ccb);
@@ -1699,11 +1695,11 @@
}
/*
- * If target has a reset in progress, freeze the devq and return. The
- * devq will be released when the TM reset is finished.
+ * If target has a reset in progress, the devq should be frozen.
+ * Geting here we likely hit a race, so just requeue.
*/
if (targ->flags & MPSSAS_TARGET_INRESET) {
- ccb->ccb_h.status = CAM_BUSY | CAM_DEV_QFRZN;
+ ccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_DEV_QFRZN;
mps_dprint(sc, MPS_INFO, "%s: Freezing devq for target ID %d\n",
__func__, targ->tid);
xpt_freeze_devq(ccb->ccb_h.path, 1);
@@ -3244,11 +3240,15 @@
}
/*
- * Set the INRESET flag for this target so that no I/O will be sent to
- * the target until the reset has completed. If an I/O request does
- * happen, the devq will be frozen. The CCB holds the path which is
- * used to release the devq. The devq is released and the CCB is freed
+ * Freeze the devq and set the INRESET flag so that no I/O will be sent to
+ * the target until the reset has completed. The CCB holds the path which
+ * is used to release the devq. The devq is released and the CCB is freed
* when the TM completes.
+ * We only need to do this when we're entering reset, not at each time we
+ * need to send an abort (which will happen if multiple commands timeout
+ * while we're sending the abort). We do not release the queue for each
+ * command we complete (just at the end when we free the tm), so freezing
+ * it each time doesn't make sense.
*/
void
mpssas_prepare_for_tm(struct mps_softc *sc, struct mps_command *tm,
@@ -3266,7 +3266,13 @@
} else {
tm->cm_ccb = ccb;
tm->cm_targ = target;
- target->flags |= MPSSAS_TARGET_INRESET;
+ if ((target->flags & MPSSAS_TARGET_INRESET) == 0) {
+ mps_dprint(sc, MPS_XINFO | MPS_RECOVERY,
+ "%s: Freezing devq for target ID %d\n",
+ __func__, target->tid);
+ xpt_freeze_devq(ccb->ccb_h.path, 1);
+ target->flags |= MPSSAS_TARGET_INRESET;
+ }
}
}
}

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 16, 4:56 PM (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15827449
Default Alt Text
D33228.diff (2 KB)

Event Timeline