git: d063d1bc9281 - main - ocs_fc: When commands complete with an error, freeze the device queue.

Ram Kishore Vegesna ram at FreeBSD.org
Thu Sep 30 07:48:18 UTC 2021


The branch main has been updated by ram:

URL: https://cgit.FreeBSD.org/src/commit/?id=d063d1bc928165e7798df5ec1c424794a1ec41e9

commit d063d1bc928165e7798df5ec1c424794a1ec41e9
Author:     Ram Kishore Vegesna <ram at FreeBSD.org>
AuthorDate: 2021-09-24 09:32:09 +0000
Commit:     Ram Kishore Vegesna <ram at FreeBSD.org>
CommitDate: 2021-09-30 07:31:17 +0000

    ocs_fc: When commands complete with an error, freeze the device queue.
    
    Proper error recovery depends on freezing the device queue when an
    error occurs, so we can recover from an error before sending
    additional commands.
    
    The ocs_fc(4) driver was not freezing the device queue for most
    SCSI errors, and that broke error recovery.
    
    sys/dev/ocs_fc/ocs_cam.c:
            In ocs_scsi_initiator_io_cb(), freeze the device queue if
            we're passing back status other than CAM_REQ_CMP.
    
    Submitted by: ken at kdm.org
    Reviewed by: mav, ken
---
 sys/dev/ocs_fc/ocs_cam.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/sys/dev/ocs_fc/ocs_cam.c b/sys/dev/ocs_fc/ocs_cam.c
index 82b5371b7875..6a9ef6160cee 100644
--- a/sys/dev/ocs_fc/ocs_cam.c
+++ b/sys/dev/ocs_fc/ocs_cam.c
@@ -1523,10 +1523,6 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io,
 		}
 	} else if (scsi_status != OCS_SCSI_STATUS_GOOD) {
 		ccb_status = CAM_REQ_CMP_ERR;
-		ocs_set_ccb_status(ccb, ccb_status);
-		csio->ccb_h.status |= CAM_DEV_QFRZN;
-		xpt_freeze_devq(csio->ccb_h.path, 1);
-
 	} else {
 		ccb_status = CAM_REQ_CMP;
 	}
@@ -1537,8 +1533,15 @@ static int32_t ocs_scsi_initiator_io_cb(ocs_io_t *io,
 
 	csio->ccb_h.ccb_io_ptr = NULL;
 	csio->ccb_h.ccb_ocs_ptr = NULL;
+
 	ccb->ccb_h.status &= ~CAM_SIM_QUEUED;
 
+	if ((ccb_status != CAM_REQ_CMP) &&
+	    ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0)) {
+		ccb->ccb_h.status |= CAM_DEV_QFRZN;
+		xpt_freeze_devq(ccb->ccb_h.path, 1);
+	}
+
 	xpt_done(ccb);
 
 	return 0;


More information about the dev-commits-src-all mailing list