[SCSI] ibmvfc: Fix error reporting for some FC errors
authorBrian King <brking@linux.vnet.ibm.com>
Wed, 29 Oct 2008 13:46:36 +0000 (08:46 -0500)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 29 Dec 2008 17:24:12 +0000 (11:24 -0600)
If either a "transport fault" or a "general transport" error is received
and no other error information is available, the command is improperly
returned as successful. Fix this to return DID_ERROR in this case.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/ibmvscsi/ibmvfc.c

index 7650707a40defc4f7a032a4972cad4afabd99af9..ae65fa60eeb44a0d1a5b786cf092e69a62767146 100644 (file)
@@ -278,13 +278,6 @@ static int ibmvfc_get_err_result(struct ibmvfc_cmd *vfc_cmd)
             rsp->data.info.rsp_code))
                return DID_ERROR << 16;
 
-       if (!vfc_cmd->status) {
-               if (rsp->flags & FCP_RESID_OVER)
-                       return rsp->scsi_status | (DID_ERROR << 16);
-               else
-                       return rsp->scsi_status | (DID_OK << 16);
-       }
-
        err = ibmvfc_get_err_index(vfc_cmd->status, vfc_cmd->error);
        if (err >= 0)
                return rsp->scsi_status | (cmd_status[err].result << 16);
@@ -1478,6 +1471,9 @@ static void ibmvfc_scsi_done(struct ibmvfc_event *evt)
                        if ((rsp->flags & FCP_SNS_LEN_VALID) && rsp->fcp_sense_len && rsp_len <= 8)
                                memcpy(cmnd->sense_buffer, rsp->data.sense + rsp_len, sense_len);
 
+                       if (!cmnd->result && (!scsi_get_resid(cmnd) || (rsp->flags & FCP_RESID_OVER)))
+                               cmnd->result = (DID_ERROR << 16);
+
                        ibmvfc_log_error(evt);
                }