]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi/lpfc: Incorrect usage of bghm for BlockGuard errors (CR 127022)
authorVaios Papadimitriou <vaios.papadimitriou@emulex.com>
Tue, 28 Aug 2012 22:33:50 +0000 (15:33 -0700)
committerJerry Snitselaar <jerry.snitselaar@oracle.com>
Wed, 5 Sep 2012 19:25:40 +0000 (12:25 -0700)
commit id: acd6859b084d1e1b3ec8bc9befe6532223260d33

Signed-off-by: Jerry Snitselaar <jerry.snitselaar@oracle.com>
drivers/scsi/lpfc/lpfc_scsi.c

index c817a15a1f91760a8a8a005dc9878aab68984393..b3e7da89084e07e1992ab17dd0ba2fae1095ab26 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
  * Fibre Channel Host Bus Adapters.                                *
- * Copyright (C) 2004-2011 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2012 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
@@ -2760,7 +2760,21 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_scsi_buf *lpfc_cmd,
                cmd->sense_buffer[8] = 0;     /* Information descriptor type */
                cmd->sense_buffer[9] = 0xa;   /* Additional descriptor length */
                cmd->sense_buffer[10] = 0x80; /* Validity bit */
-               bghm /= cmd->device->sector_size;
+
+               /* bghm is a "on the wire" FC frame based count */
+               switch (scsi_get_prot_op(cmd)) {
+               case SCSI_PROT_READ_INSERT:
+               case SCSI_PROT_WRITE_STRIP:
+                       bghm /= cmd->device->sector_size;
+                       break;
+               case SCSI_PROT_READ_STRIP:
+               case SCSI_PROT_WRITE_INSERT:
+               case SCSI_PROT_READ_PASS:
+               case SCSI_PROT_WRITE_PASS:
+                       bghm /= (cmd->device->sector_size +
+                               sizeof(struct scsi_dif_tuple));
+                       break;
+               }
 
                failing_sector = scsi_get_lba(cmd);
                failing_sector += bghm;