]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ocs_fc: Fix CAM status reporting in ocs_fc(4) when no data is returned.
authorRam Kishore Vegesna <ram@FreeBSD.org>
Fri, 24 Sep 2021 09:19:49 +0000 (14:49 +0530)
committerRam Kishore Vegesna <ram@FreeBSD.org>
Thu, 30 Sep 2021 07:31:16 +0000 (13:01 +0530)
commit1af49c2eeb4a05f524ed9a6657c741bc96fbaf87
tree04d0fcb9d093b75db88aa8e93f8c4c5ade7f696b
parent322dbb8ce8f63fd6f542309fd38324664ce8dd3f
ocs_fc: Fix CAM status reporting in ocs_fc(4) when no data is returned.

        In ocs_scsi_initiator_io_cb(), if the SCSI command that is
        getting completed had a residual equal to the transfer length,
        it was setting the CCB status to CAM_REQ_CMP.

        That breaks the expected behavior for commands like READ ATTRIBUTE.
        For READ ATTRIBUTE, if the first attribute requested doesn't exist,
        the command is supposed to return an error (Illegal Request,
        Invalid Field in CDB).  The broken behavior for READ ATTRIBUTE
        caused LTFS tape formatting to fail.  It looks for attribute
        0x1623, and expects to see an error if the attribute isn't present.

        In addition, if the residual is negative (indicating an overrun),
        only set the CCB status to CAM_DATA_RUN_ERR if we have not already
        reported an error.  The SCSI sense data will have more detail about
        what went wrong.

        sys/dev/ocs_fc/ocs_cam.c:
                In ocs_scsi_initiator_io_cb(), don't set the status to
                CAM_REQ_CMP if the residual is equal to the transfer length.

                Also, only set CAM_DATA_RUN_ERR if we didn't get SCSI
                status.

Submitted by: ken@kdm.org
Reviewed by: mav, ken
sys/dev/ocs_fc/ocs_cam.c