]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_scsi.c
[SCSI] lpfc 8.1.2: Fix panic caused by HBA resets and target side cable pulls
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_scsi.c
index dafabeefc5b3589de869a1c63b0703bfe512270a..094f18f1fa05c0ba6ba3aa580a151497d2804c08 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-2005 Emulex.  All rights reserved.           *
+ * Copyright (C) 2004-2006 Emulex.  All rights reserved.           *
  * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig              *
@@ -467,7 +467,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
        sdev = cmd->device;
        cmd->scsi_done(cmd);
 
-       if (!result &&
+       if (!result && pnode != NULL &&
           ((jiffies - pnode->last_ramp_up_time) >
                LPFC_Q_RAMP_UP_INTERVAL * HZ) &&
           ((jiffies - pnode->last_q_full_time) >
@@ -495,7 +495,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
         * Check for queue full.  If the lun is reporting queue full, then
         * back off the lun queue depth to prevent target overloads.
         */
-       if (result == SAM_STAT_TASK_SET_FULL) {
+       if (result == SAM_STAT_TASK_SET_FULL && pnode != NULL) {
                pnode->last_q_full_time = jiffies;
 
                shost_for_each_device(tmp_sdev, sdev->host) {
@@ -743,7 +743,7 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf * lpfc_cmd, struct lpfc_hba * phba)
 const char *
 lpfc_info(struct Scsi_Host *host)
 {
-       struct lpfc_hba    *phba = (struct lpfc_hba *) host->hostdata[0];
+       struct lpfc_hba    *phba = (struct lpfc_hba *) host->hostdata;
        int len;
        static char  lpfcinfobuf[384];
 
@@ -803,7 +803,7 @@ static int
 lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
 {
        struct lpfc_hba *phba =
-               (struct lpfc_hba *) cmnd->device->host->hostdata[0];
+               (struct lpfc_hba *) cmnd->device->host->hostdata;
        struct lpfc_sli *psli = &phba->sli;
        struct lpfc_rport_data *rdata = cmnd->device->hostdata;
        struct lpfc_nodelist *ndlp = rdata->pnode;
@@ -877,7 +877,7 @@ static int
 lpfc_abort_handler(struct scsi_cmnd *cmnd)
 {
        struct Scsi_Host *shost = cmnd->device->host;
-       struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
+       struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata;
        struct lpfc_sli_ring *pring = &phba->sli.ring[phba->sli.fcp_ring];
        struct lpfc_iocbq *iocb;
        struct lpfc_iocbq *abtsiocb;
@@ -981,7 +981,7 @@ static int
 lpfc_reset_lun_handler(struct scsi_cmnd *cmnd)
 {
        struct Scsi_Host *shost = cmnd->device->host;
-       struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
+       struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata;
        struct lpfc_scsi_buf *lpfc_cmd;
        struct lpfc_iocbq *iocbq, *iocbqrsp;
        struct lpfc_rport_data *rdata = cmnd->device->hostdata;
@@ -1094,7 +1094,7 @@ static int
 lpfc_reset_bus_handler(struct scsi_cmnd *cmnd)
 {
        struct Scsi_Host *shost = cmnd->device->host;
-       struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0];
+       struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata;
        struct lpfc_nodelist *ndlp = NULL;
        int match;
        int ret = FAILED, i, err_count = 0;
@@ -1195,7 +1195,7 @@ out:
 static int
 lpfc_slave_alloc(struct scsi_device *sdev)
 {
-       struct lpfc_hba *phba = (struct lpfc_hba *)sdev->host->hostdata[0];
+       struct lpfc_hba *phba = (struct lpfc_hba *)sdev->host->hostdata;
        struct lpfc_scsi_buf *scsi_buf = NULL;
        struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
        uint32_t total = 0, i;
@@ -1251,7 +1251,7 @@ lpfc_slave_alloc(struct scsi_device *sdev)
 static int
 lpfc_slave_configure(struct scsi_device *sdev)
 {
-       struct lpfc_hba *phba = (struct lpfc_hba *) sdev->host->hostdata[0];
+       struct lpfc_hba *phba = (struct lpfc_hba *) sdev->host->hostdata;
        struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
 
        if (sdev->tagged_supported)