Patch "scsi: lpfc: Fix list corruption in lpfc_sli_get_iocbq" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    scsi: lpfc: Fix list corruption in lpfc_sli_get_iocbq

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     scsi-lpfc-fix-list-corruption-in-lpfc_sli_get_iocbq.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fb57bc191019e1b3f7379f568227841f41ff2614
Author: James Smart <jsmart2021@xxxxxxxxx>
Date:   Sat Sep 21 20:58:59 2019 -0700

    scsi: lpfc: Fix list corruption in lpfc_sli_get_iocbq
    
    [ Upstream commit 15498dc1a55b7aaea4b51ff03e3ff0f662e73f44 ]
    
    After study, it was determined there was a double free of a CT iocb during
    execution of lpfc_offline_prep and lpfc_offline.  The prep routine issued
    an abort for some CT iocbs, but the aborts did not complete fast enough for
    a subsequent routine that waits for completion. Thus the driver proceeded
    to lpfc_offline, which releases any pending iocbs. Unfortunately, the
    completions for the aborts were then received which re-released the ct
    iocbs.
    
    Turns out the issue for why the aborts didn't complete fast enough was not
    their time on the wire/in the adapter. It was the lpfc_work_done routine,
    which requires the adapter state to be UP before it calls
    lpfc_sli_handle_slow_ring_event() to process the completions. The issue is
    the prep routine takes the link down as part of it's processing.
    
    To fix, the following was performed:
    
     - Prevent the offline routine from releasing iocbs that have had aborts
       issued on them. Defer to the abort completions. Also means the driver
       fully waits for the completions.  Given this change, the recognition of
       "driver-generated" status which then releases the iocb is no longer
       valid. As such, the change made in the commit 296012285c90 is reverted.
       As recognition of "driver-generated" status is no longer valid, this
       patch reverts the changes made in
       commit 296012285c90 ("scsi: lpfc: Fix leak of ELS completions on adapter reset")
    
     - Modify lpfc_work_done to allow slow path completions so that the abort
       completions aren't ignored.
    
     - Updated the fdmi path to recognize a CT request that fails due to the
       port being unusable. This stops FDMI retries. FDMI will be restarted on
       next link up.
    
    Link: https://lore.kernel.org/r/20190922035906.10977-14-jsmart2021@xxxxxxxxx
    Signed-off-by: Dick Kennedy <dick.kennedy@xxxxxxxxxxxx>
    Signed-off-by: James Smart <jsmart2021@xxxxxxxxx>
    Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index 25e86706e207..f883fac2d2b1 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -1868,6 +1868,12 @@ lpfc_cmpl_ct_disc_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 		if (irsp->ulpStatus == IOSTAT_LOCAL_REJECT) {
 			switch ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK)) {
 			case IOERR_SLI_ABORTED:
+			case IOERR_SLI_DOWN:
+				/* Driver aborted this IO.  No retry as error
+				 * is likely Offline->Online or some adapter
+				 * error.  Recovery will try again.
+				 */
+				break;
 			case IOERR_ABORT_IN_PROGRESS:
 			case IOERR_SEQUENCE_TIMEOUT:
 			case IOERR_ILLEGAL_FRAME:
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 0052b341587d..f293b48616ae 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -8016,6 +8016,9 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport)
 		if (piocb->vport != vport)
 			continue;
 
+		if (piocb->iocb_flag & LPFC_DRIVER_ABORTED)
+			continue;
+
 		/* On the ELS ring we can have ELS_REQUESTs or
 		 * GEN_REQUESTs waiting for a response.
 		 */
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index f7c205e1da48..1286c658ba34 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -700,7 +700,10 @@ lpfc_work_done(struct lpfc_hba *phba)
 			if (!(phba->hba_flag & HBA_SP_QUEUE_EVT))
 				set_bit(LPFC_DATA_READY, &phba->data_flags);
 		} else {
-			if (phba->link_state >= LPFC_LINK_UP ||
+			/* Driver could have abort request completed in queue
+			 * when link goes down.  Allow for this transition.
+			 */
+			if (phba->link_state >= LPFC_LINK_DOWN ||
 			    phba->link_flag & LS_MDS_LOOPBACK) {
 				pring->flag &= ~LPFC_DEFERRED_RING_EVENT;
 				lpfc_sli_handle_slow_ring_event(phba, pring,
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e847244dfde3..9c5b1d138eb1 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -11050,9 +11050,6 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 				irsp->ulpStatus, irsp->un.ulpWord[4]);
 
 		spin_unlock_irq(&phba->hbalock);
-		if (irsp->ulpStatus == IOSTAT_LOCAL_REJECT &&
-		    irsp->un.ulpWord[4] == IOERR_SLI_ABORTED)
-			lpfc_sli_release_iocbq(phba, abort_iocb);
 	}
 release_iocb:
 	lpfc_sli_release_iocbq(phba, cmdiocb);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux