]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Fix driver incorrectly building fcpCdb during scsi command prep (CR 126209)
authorVaios Papadimitriou <vaios.papadimitriou@emulex.com>
Tue, 8 May 2012 22:01:22 +0000 (17:01 -0500)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Wed, 9 May 2012 00:01:22 +0000 (17:01 -0700)
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 <maxim.uvarov@oracle.com>
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_scsi.h

index 9b2b1be7919b0fed025c2c585cfac0132856af6f..ddee3298309ce845a7ccbc65e74528958b4b39fe 100644 (file)
@@ -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:
index 669f965e071bdeef65b15fc3977e3f9a0164fb38..9075a08cf78155af9ee0a635453bbd6ff9512f31 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/byteorder.h>
 
 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 */
 
 };