From: Vaios Papadimitriou Date: Tue, 8 May 2012 22:01:22 +0000 (-0500) Subject: Fix driver incorrectly building fcpCdb during scsi command prep (CR 126209) X-Git-Tag: v2.6.39-400.9.0~423^2~123^2~34 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=cb53f0d7383454c09a696806a02beb403b87ebe3;p=users%2Fjedix%2Flinux-maple.git Fix driver incorrectly building fcpCdb during scsi command prep (CR 126209) Some scsi inquiry commands were failing with sense key 0x5 and ASC/ASCQ values of 24/00. At times, this failure cause retries over several hours because the driver was returning DID_BUS_BUSY. These retries and failures were clogging up the console logs. Now, always initialize the fcpCdb to 0 during lpfc_scsi_prep_cmnd. After the memset, only copy scsi_cmnd->cmd_len bytes into the fcpCdb. commit id: df9e1b59f9e4671930a7762b9518461df4ea85f5 Signed-off-by: Maxim Uvarov --- diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 9b2b1be7919b..ddee3298309c 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -2912,8 +2912,8 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd, int_to_scsilun(lpfc_cmd->pCmd->device->lun, &lpfc_cmd->fcp_cmnd->fcp_lun); - memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, 16); - + memset(&fcp_cmnd->fcpCdb[0], 0, LPFC_FCP_CDB_LEN); + memcpy(&fcp_cmnd->fcpCdb[0], scsi_cmnd->cmnd, scsi_cmnd->cmd_len); if (scsi_populate_tag_msg(scsi_cmnd, tag)) { switch (tag[0]) { case HEAD_OF_QUEUE_TAG: diff --git a/drivers/scsi/lpfc/lpfc_scsi.h b/drivers/scsi/lpfc/lpfc_scsi.h index 669f965e071b..9075a08cf781 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.h +++ b/drivers/scsi/lpfc/lpfc_scsi.h @@ -21,6 +21,7 @@ #include struct lpfc_hba; +#define LPFC_FCP_CDB_LEN 16 #define list_remove_head(list, entry, type, member) \ do { \ @@ -102,7 +103,7 @@ struct fcp_cmnd { #define WRITE_DATA 0x01 /* Bit 0 */ #define READ_DATA 0x02 /* Bit 1 */ - uint8_t fcpCdb[16]; /* SRB cdb field is copied here */ + uint8_t fcpCdb[LPFC_FCP_CDB_LEN]; /* SRB cdb field is copied here */ uint32_t fcpDl; /* Total transfer length */ };